Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

trackBy doesn't work as expected #257

Copy link
Copy link
@WuglyakBolgoink

Description

@WuglyakBolgoink
Issue body actions

Hallo!

if ( Array.isArray( propertyNames ) ) {
cacheKey = propertyNames.join( "->" );
// Ensure cached identity function.
if ( ! cache[ cacheKey ] ) {
cache[ cacheKey ] = function trackByProperty<T>( index: number, item: T ) : any {
var values = [];
// Collect the item values that will be aggregated in the resultant
// item identity
for ( var propertyName of propertyNames ) {
values.push( item[ propertyName ] );
}
return( values.join( "->" ) );
};
}

This part for a list of properties doesn't work correctly.

the list will be re'rendered each time if I click on refresh button with the same data. If I move the code into separate function and use directly on trackBy, then the list will be never re'rendered...

any Idea?


Outputs:

on start:
image

after click on refresh button:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.