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

Fix Compatibility with Immer Middleware #54

Open
wants to merge 2 commits into
base: staging
Choose a base branch
from

Conversation

joebobmiles
Copy link
Owner

See #53.

Immer invokes Object.freeze on non-primitive values such as arrays and objects. This is how it achieves immutability. This presents two problems for the Yjs middleware:

  1. Client updates must obey Immer's rules for modifying objects and arrays (annoying but doable).
  2. State updates triggered on the client by a peer need to either:
    a. Invoke Immer's produce function (unfavorable coupling), or
    b. Detect if the object to modify is frozen or otherwise inextensible and treat it as immutable.

@joebobmiles joebobmiles self-assigned this Jul 3, 2023
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.

1 participant