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

WIP: assign arrays and root-elements directly #89

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bigmistqke
Copy link

@bigmistqke bigmistqke commented Dec 16, 2022

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)

use solid/store.createMutable to wire up reactivity
to enable idiomatic use of objects and arrays in solid's Flow-Components
an array of parseYjsReturnValue is returned when the object is accessed
with a symbol that is not $reactiveproxy, $reactive or $skipreactive.
@nadilas
Copy link

nadilas commented Mar 25, 2023

How can we help to move this along?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants