Skip to content

proxyMap breaks when bind(state, ymap) runs #39

@hobo1618

Description

@hobo1618

Hello! I'm creating a NextJS app using valtio-yjs and tiptap collab's beta WS server. Everything works fine until I try to create a new proxyMap in the store.

I created minimal version of the issue with three scenarios:

  1. todos stored as a Map of key value pairs using Valtio's proxyMap --> this works
  2. todos stored as a Map and bound to a ymap using valtio-yjs's bind() --> this results in an error: TypeError: snap.myMap.keys is not a function or its return value is not iterable
  3. todos stored as an Array and bound to a ymap --> this works fine.

To see for yourself, go to this vercel deployment, open up an incognito window, and try adding some todos. Valtio-YJS works fine for collaborative arrays and for local maps.

But this deployment (when I bind the proxyMap to the YDoc) crashes immediately.

Any idea why this is happening and how to fix it?

Thanks so much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions