Replies: 1 comment 1 reply
-
Putting functions into an observable is totally fine, and a recommended pattern. Functions get extracted from the raw data and put into observable metadata, so when it's serialized into persistence it doesn't include the functions. Does that answer your question? If not could you share a bit of code? I'm not totally following what you're trying to do. A plugin like redux devtools is very much needed. We're planning to start building out dev tools like that after we release v3, but if you want to start it now that would be a huge help! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm curious what the stance is on this with Legend-State. I know with things like Redux its not something you want to do as the methodology around Redux is that the entire state can be serialized, I was wondering if that is the same principle here.
A use case we have is that we have a monorepo with an npm workspaces folder for common modules, one being a websocket context that handles sending and receiving messages and executing functions based on specific topics. Our solution is to register with a useRef inside the provider the topic label and a function to execute. Now that this component is being moved to the workspace, I'm having a hard time figuring out how to get access to the map of labels / functions and maybe use Legend-State? Otherwise I can hoist the ref outside of the provider.... but with other modules we expose the legend-state state so that the application using the module can proxy their global state to the module state for ease of use and keeping this consistent across all modules would be ideal.
Any advice or guidance is much appreciated.
On an unrelated note, I started making a plugin like redux devtools to see global state as it updates, I didn't see anything already available. Is that a thing somewhere I just don't know about? Or is this something that is currently needed?
Beta Was this translation helpful? Give feedback.
All reactions