Handling model layer in a local-first SPA
Unanswered
Tramp ant posted this in #help-forum
Tramp antOP
I have several React components that need to be able to update and subscribe to changes from my data layer. Most of the data model changes will not result in a re-render.
What's the best way to handle this? I'm thinking of React-RxJS observables, but that doesn't seem popular. All of the popular state management frameworks like Zustand seem designed for state changes that should result in a re-render.
What's the best way to handle this? I'm thinking of React-RxJS observables, but that doesn't seem popular. All of the popular state management frameworks like Zustand seem designed for state changes that should result in a re-render.
4 Replies
Polar bear
You could always memoiz it to not cause rerender
Tramp antOP
I'm probably going to go with Zustand
@Tramp ant I have several React components that need to be able to update and subscribe to changes from my data layer. Most of the data model changes will not result in a re-render.
What's the best way to handle this? I'm thinking of React-RxJS observables, but that doesn't seem popular. All of the popular state management frameworks like Zustand seem designed for state changes that should result in a re-render.
If the data layer changes won’t result in re-render, how do you know if the operation completed successfully or failed?
@Luis If the data layer changes won’t result in re-render, how do you know if the operation completed successfully or failed?
Tramp antOP
there is a lot of logic behind the scenes the user doesn't need to know about. from the user's perspective, they're just typing in a document - that might result in changing the contents of another open document (in which case, obviously we do need a re-render) or it might not.