Just nosey about the dev team's UI state management experience #6022
-
Hi team! 👋 I know CodeSandbox has went through a few state management libraries. I think mobx-state-tree, then Cerebral, now Overmind. As you have a really large, production app, with lots of UI state, I'm particularly interested in your dev team's thoughts about UI state management. Feel free to answer any of these in any order.
Thanks in advance if you choose to answer any of this. Continuing to wish your team well with your company! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @corysimmons and thanks for your questions! Let me try to answer them to the best of my ability 😄 Some history Redux: At the time CodeSandbox ran on Redux it was a lot of boilerplate and there was no strong concept of dealing with actual application logic and side effects in Redux. You had thunks, but no strong opinions on how to organise it. Since CodeSandbox has a LOT of complex client side logic, it became very difficult to reason about "What actually happens when you open a sandbox?" Cerebral: By using the concept of sequences we were able to co locate all the complexity of the logic and make things way more readable. Also with the help of the devtool there was never any question about what state changes were made where and what was actually running at any time in the client, including side effects which it has a first class concept for. Overmind: With our jump to TypeScript Overmind gave us all the benefits of Cerebral, but with an API surface that was compatible with TypeScript. Overmind is running today and still serves the client well. That said, we have identified new things we want to fix (see point 2.)
I hope these were helpful answers! Please let me know if something was unclear or I missed answering something, we can just continue the thread here 😄 👍 |
Beta Was this translation helpful? Give feedback.
Hi @corysimmons and thanks for your questions! Let me try to answer them to the best of my ability 😄
Some history
Originally CodeSandbox was written in Redux and I actually did a talk on why we moved to Cerebral (Which used mobx-state-tree as the state store): https://www.youtube.com/watch?v=uni-dG6-Rq8. In short Redux at that time had a ton of boilerplate across a multitude of files, making it very hard to reason about the codebase and how thing actually worked. It also had several performance issues in the UI related to the considerations you have to make leaning on traditional "value comparison" of React. Wrote an article about this here: https://itnext.io/updating-uis-value-comparison…