-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
[Bug Report][3.7.2] VAutocomplete: "Multiple nodes with the same ID" error when backspacing after "no-data" state #20516
Comments
There is something wrong in version 3.7.2 causing this error message.
The error is coming from where I create the navigation menu, but it is reported on a line of code that has nothing to do with this. In version 3.7.1 I am getting no error. |
I have the same error with v-combobox on version 3.7.2. After switching to version 3.7.1 there is no error. My combo: Steps to reproduce:
|
I'm also getting this: <v-autocomplete>
<template #item="{ item }">
<v-list-item
:id="item.raw.key"
:to="item.raw.to"
@click="selectItem"
>
...
</template>
</v-autocomplete> I tried to add the |
Getting this too but with list items |
Issue persists with vuetify 3.7.3 and vue 3.5.12 |
@J-Sek would you mind having a look at this issue? We solved one issue but introduced a new one, do you have an idea how to approach a fix for the problem above? |
It looks like list items are keyed by |
+1 Also getting this with |
@Asko-Dev, could you share code with playground? I would check if my current PR covers this or not. |
Is there a playground that includes vue-router? Otherwise I can try to setup a new repository. |
The dev environment in this repo has it: https://vuetifyjs.com/en/getting-started/contributing/#local-development |
Or fork this Stackblitz project |
I hope I did this right, first time using it. Just let it all load and it should show the warning. Thank you https://stackblitz.com/edit/vuetify-base-qjaut5?file=pages%2Findex.vue |
Same with |
In my case it was a wrongly keyed |
in my project the |
I think that this makes sense and is a valid use case. From an api point of view it's also a little bit problematic causing a runtime side effect, by just adding another |
Even easier would be to set // VListItem.tsx sources, line 118
const id = computed(() => props.value === undefined ? link.href.value : props.value) |
much easier |
Just to add to this, I'm experiencing the same warning/error currently in a completely different case than I see described here. Sorry, it's a bit complex. It's also only for a single selection VAutocomplete (not multiple) I have a VAutocomplete that I've built some async stuff on top of. When typing in the autocomplete, a request is debounced to send the search term to the backend, so only one request is sent. One is the "cached" selection (items selected on the client side) and the other is the new selection list (query specifically ensures the selection does not include anything from "cached." So the items provided to the VAutocomplete are entirely unique, in both names (title) and IDs (value) as confirmed by the results of the response body. After making a selection and the model value updates, a request is sent to sync the cached values and update the selection again. This is when I'm getting that warning/error.
I'm also ensuring that only request is sent after making a selection, even though the search text is reset. So in my case, it seems to happen when the items are updated after making a selection. The item causing the duplicate error isn't present in the list when the selection is made, so it's not like the list pre-selection happens to include the same item causing the error after the list is updated post-selection. To try to illustrate the flow of actions
Another search and selection:
search text watcher fires from typing but request isn't sent until handle search debounce In both of these examples, the items returned by the request are actually the same lists (they happen to be the first 50 results of the dataset when the search text isn't used in the query being executed in the backend), but it's a different item in that list that is causing the error depending on the search and selection made, but it will consistently be the same two when I do the same exact search and selection Seems like something strange happening in assigning the nodes for the list render, even when there are no duplicate values of any sort in the items being provided Addendum: no-filter is also set to true, so that the list isn't filtered by vuetify at the same time as typing in the search input |
Your gut feeling is correct. The warning depends on nested lists resolution that is currently closely related to the order in which Vue decides to render VListItems - which is not "clear all » render all" but rather an algorithm going through vnodes applying changes in the most cost-efficient way. I believe your issue would be resolved by both solutions suggested in the currently open PR. It's just a matter of Kael's decision. If you could provide minimal repro on the Playground I could verify it even earlier. |
Thanks for the speedy reply and confirmation. I'll try to a Playground up and respond but work comes first unfortunately. I've already spent too much time reworking our asnyc autocomplete -_- (which is how I discovered this) |
Environment
Vuetify Version: 3.7.2
Last working version: 3.7.1
Vue Version: 3.4.27
Browsers: Opera 113.0.0.0
OS: Mac OS 10.15.7
Steps to reproduce
Type a random string until "no data available" appears, then backspace until field is empty
Expected Behavior
No error in console
Actual Behavior
"Multiple nodes with the same ID" error
Reproduction Link
https://play.vuetifyjs.com/#...
Other comments
Caused by 970f827#diff-9e9ae93c534ad2f413745ba1b6de47726b919dcb966ea267faaa99f75b337a96R219
The text was updated successfully, but these errors were encountered: