Skip to content

[enhancement] track-by to allow using path instead of key #2632

Closed
@dragantl

Description

@dragantl

Vue.js version

1.0.20

Reproduction Link

https://jsfiddle.net/ardoramor/hyk86ca3/

Steps to reproduce

Run fiddle, examine console.

What is Expected?

Entries will be tracked by the specified path, just like in filters (e.g., orderBy)

What is actually happening?

VueJs prints out a warning and fails to get the unique value specified by path

Required change

There are three lines that would need to change from value[trackByKey] to getPath(value, trackByKey) in functions cacheFrag, getCachedFrag, and deleteCachedFrag. I can make a PR but maybe such a small change doesn't require it?

Also, is it possible to add expression evaluation for track-by? This way, a combination of fields can yield a unique identifier (e.g., track-by="employee.company + employee.id", in case id can be reused by companies). I have a different application but this should make sense as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions