Skip to content

Conversation

@SaulIO
Copy link
Contributor

@SaulIO SaulIO commented Oct 17, 2019

The framework needs the keys to be stable for performant rerender. Index is inherently unstable.

The framework needs the keys to be stable for performant rerender. Index is inherently unstable.
Copy link
Owner

@JosephusPaye JosephusPaye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Just one thing to consider.


:highlighted="highlightedIndex === index"
:key="index"
:key="JSON.stringify(suggestion)"
Copy link
Owner

@JosephusPaye JosephusPaye Oct 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could potentially lead to an error if suggestion has a circular reference.

Probably not likely, but it's something to keep in mind.

Maybe we could just require a unique key property on the suggestion if it's an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how likely there is a good use case for a circular reference within an autocomplete though?

At that level it seems more like a coding error.

Could require a key, but automating is nice. Tbf, I'd probably slice it too after stringify.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants