mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-26 08:34:11 +01:00
3ab932dddc
## About The Pull Request This has been a long project that has undergone several iterations. I needed to complete #94514 just to get here, and this is surprisingly simpler despite handling much more code. This PR replaces the bespoke redux-based solution with [jotai](https://jotai.org/), a lean state manager. For the most part, this means the UI will be a bit more responsive. I'll post the philosophy from the docs: In the previous TGUI backend state, both DM messages and UI actions were handled through an event message system using actions, selectors, reducers, and middleware. This new event system is designed to handle only DM messages - separating UI actions into direct state access (eg setSomeState(true)) or helpers (eg updateSetting({ thing: true})). The idea behind this was to reduce the amount of abstractions needed and draw a clear line between what is a server message and what is a UI action. There are three components to this system: 1. The event bus, which maintains the list of handlers. 2. The handlers, which delegate backend calls and update application state. 3. The store, ie the application state. ## Why It's Good For The Game The previous solution would do a full tree rerender when any backend message or UI event took place, including pings. We don't need to do this now. We can atomically update the components when they need updated. The code should be easier to maintain (fully documented and concise) The UI should be more reliable ## Changelog N/A