Skip to content

trackBy doesn't work as expected #257

Description

@WuglyakBolgoink

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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