Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:key="index" => :key="JSON.stringify(suggestion)" #476

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/UiAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
ref="suggestions"

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

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.

:keys="keys"
:suggestion="suggestion"
:type="type"
Expand Down