mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
# Refactor Turbo Renderer State Management to Use RxJS ### TL;DR Refactored the TurboRenderer state management to use RxJS observables instead of direct state mutations, improving state transitions and reactivity. ### What changed? - Replaced the public `state` property with a private `state$` BehaviorSubject in `ViewportTurboRendererExtension` - Added proper state transition logging using RxJS operators - Combined multiple event subscriptions using `merge` operator for better organization - Improved state transition logic in the `refresh()` method - Updated the `zooming$` and `panning$` signals in the Viewport ### Why make this change? This refactoring improves the codebase by: 1. Using a more consistent reactive programming model with RxJS 2. Making state transitions more explicit and traceable 3. Reducing potential bugs from manual state management 4. Improving code organization by combining related event streams 5. Ensuring proper cleanup of resources when components are disposed The change maintains the same functionality while making the code more maintainable and the state management more robust.
BlockSuite Framework
Here are the vanilla framework packages in BlockSuite.