-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
When using reconcile to set a store object and reusing the object given to reconcile to set another store object, the code breaks in an unexpected manner. Reusing the same object as a base for reconciliation on two different stores leads to some entanglement that is unexpected.
- In my example code in the playground I have a
baseListobject which serves as the data sources - There is also a
storedListand aderivedListstore object, having different use cases to accomplish. - In the
storedListstore object there will beListEntrys put in as{ value: number; }objects. - Saved in the
derivedListstore object are the last 6 entries of thestoredList - Every click on the "Add" button increments a counter
currentand puts a new list entry intobaseList - Then the
baseListis deep copied - This deep copy is used to reconciliate the
storedListstore object - That same deep copy is used to reconciliate the
derivedListstore object
After the reconciliation of derivedList, the storedList store object is mutated as well, which is unexpected to me.
I have found, and commented it in the code, 2 possible fixes to this constellation. It seems the reusage of the same underlying object leads to this behaviour when utilizing reconcile.
I have read reconcile is gonna get a rework in the 2.0 version. Will this still be a bug in the new version?
Your Example Website or App
https://playground.solidjs.com/anonymous/41a51eb9-de0c-4293-a35c-2ce85c6be36b
Steps to Reproduce the Bug or Issue
- Go to the playground and use the example.
- Click on the "Add" button
- Notice the console log output.
Expected behavior
The console should put out an array with integers in order, like [1,2,3,4,...] but it puts out wrong values for the first 6 elements after 6 clicks.
Screenshots or Videos
Expected output (after 1 of the 2 fixes in comments applied):
Wrong output:
Code
Platform
- Browser
Additional context
No response


