-
I use the zustand middleware, and in my options I've selected a top-level object for storage:
If This recursive behavior is convenient but I would like to elect certain parts of state to be treated as atomic objects rather than live structures, both for performance and to avoid the known "ghosting" bug. For example, I have many pieces of state that are small fixed-size lists (3-dimensional coordinates), and I always update them atomically, so it's needless work to make then into CRDT's, since that would imply that each time I do a replacement, LiveBlocks is internally formulating 3 insert ops followed by 3 remove ops. It would be great if the mapping keys could be more sophisticated to support "deep" parts of state. For example:
Is something like this already supported? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi Philip, unfortunately electing specifically which parts of deep structures to sync as Live structures is currently not possible. The Possible ways around that are currently:
Perhaps there will be opportunities for us to support this better and more structurally in the longer term with schema validation. If the Zustand client would have knowledge about the room's schema somehow, for example, it could understand which arrays to treat as arrays and which to turn into LiveLists automatically. We will realistically not get to work on this in the near term, given our other priorities. I hope the suggested workarounds at least offer you a way around this issue in the near term, but this is great feedback that will drive how we will evolve our APIs in the future. Please let us know if we can be of any further help! |
Beta Was this translation helpful? Give feedback.
Hi Philip, unfortunately electing specifically which parts of deep structures to sync as Live structures is currently not possible. The
storageMapping
is pretty simplistic configuration, which only supports top-level keys, and opting-in is all or nothing.Possible ways around that are currently:
[1, 2, 3]
as"1,2,3"
instead).@liveblocks/client
to more directly control your storage tree shape.Perhaps there will be opportunities for us to support this better and more structu…