'reconcile' mutates array items
Describe the bug
I want to develop something like Combobox component - input field with a list of suggestions.
These suggestions are stored on the server, so I have to use createStore and reconcile to optimise the rendering of the new items.
I managed to add search field and display suggestions by field value, but I noticed that reconcile mutates array items and after a while the list displays the same suggestion multiple times.
Your Example Website or App
https://playground.solidjs.com/anonymous/e7f8746a-97f3-4edb-8fcf-041905c5660d
Steps to Reproduce the Bug or Issue
- Go to the example
- Click on the input
- Press
3, pressDeletefew times.
Expected behavior
As a user, I expected to get the same suggestions while typing, but after some time the list displays the same suggestion multiple times.
Screenshots or Videos
https://github.com/solidjs/solid/assets/27158929/ea9b28cb-6def-47ed-9f97-72ac6994fbcc
I encounter the identical issue where I am pushing an object into the beginning of an array. When the array's length reaches 2, the first and second elements are identical, including their memory addresses.
@phy-lei I solved the problem by adding key option to reconcile.
@sdreva Thanks, I tried it and the problem was resolved.