-
I watched This is bit of a long question but I guess background is important. I have recently did a POC with React & MobX state manager with deeply nested object as store to see how it performs. I have two videos in readme to show the issue I was facing. https://github.com/s1n7ax/poc-react-mobx-complex-form
In terms of behavior, it's similar to Leptos 0.7 store, meaning, it tracks exact path of properties that's used inside a observed closure (in this case it's a react functional component) and only updates the component if there is a change in that exact path. Reactivity works absolutely perfectly meaning it only updates the components that uses the exact path. When I first load the page, I get the immediate view of all components thanks to SSR BUT it took hell of a long time for those components to be interactive for 500 components which shouldn't be a big deal in theory. I asked this question on reddit to understand what the hell is going on. https://www.reddit.com/r/reactjs/comments/1gh1sy3/time_to_be_intractable_is_high_with_mobx/ Conclusion is, on the browser, to make all those 500 components reactive, MobX has to proxy the deeply nested object which includes all 500 of the element data and then render them at least once on browser to detect all the dependencies, then only everything is reactive. HOWEVER, MUI elements takes a huge amount of time to render because they are somewhat heavy (confirmed by MUI contributor in the comments), so 500 takes around 5 seconds and all that is blocking so the entire page is frozen for 5 seconds. Here, in the video you mentioned something about a separate hash map since there are no proxies in Rust. So my question is, do you hydrate that hash map from server to client so on browser you don't even need a initial render to detect the dependencies of each property meaning everything is reactive in an instant if I did the same kind of test in Leptos with Leptos Store? I think this is a huge game changer for me at least if that's the case. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hm yeah, bunch of separate questions here.
Do you mean that there are 500 items in the list of things going into the And of course, as always, make sure your results are coming from release mode as opposed to dev/debug mode, especially for a heavy page like this. |
Beta Was this translation helpful? Give feedback.
This is the gap in understanding. Like any framework that hydrates, yes, Leptos will run your application code once on the server (to generate HTML) and then once on the client (to add interactivity to that HTML). That means that if you do something expensive in your logic, it happens in each of those places.
"Hydrate the HashMap" would mean something like "serialize the keys and values of the HashMap, send that as JSON from the server to the client, then deserialize it into a new HashMap on the client." In any framework and any programming lang…