This is a WIP for enabling the direct assignment of arrays and root-elements. The intent is to remove some of the friction when using SyncedStore, make it behave more like a regular store and less Yjs-related.
A reconcile-function takes entered state, diffs it with the previous state and turns it into a series of granular operations: only changed values are updated.
I have been playing around with it today and I covered some edge-cases already:
excess keys from an object (Map/Doc) are deleted
excess indices from an array are deleted
in case an array is set with an index that is larger then the array itself, the array is padded with nulls
but I am sure there are more edge cases to be found.
only tested locally, with solid as framework.
current 'leaks' from yjs still present: it will error if you try to assign p.ex an object to a root-element which has earlier been defined as an array. all the other data's shapes can be changed.
(based on my solid-edits because I am using solid to test. can be rebased if necessary)
This is a WIP for enabling the direct assignment of arrays and root-elements. The intent is to remove some of the friction when using SyncedStore, make it behave more like a regular store and less Yjs-related.
A reconcile-function takes entered state, diffs it with the previous state and turns it into a series of granular operations: only changed values are updated.
I have been playing around with it today and I covered some edge-cases already:
but I am sure there are more edge cases to be found. only tested locally, with solid as framework.
current 'leaks' from yjs still present: it will error if you try to assign p.ex an object to a root-element which has earlier been defined as an array. all the other data's shapes can be changed.
(based on my solid-edits because I am using solid to test. can be rebased if necessary)