refactor(desktop): migrate storage to tRPC, fix race condition
Merged
KI
1y ago+688+688+012345678901234567890123456789-492-492-012345678901234567890123456789
Summary
- Migrate tabs and theme storage from raw IPC handlers to tRPC
- Fix race condition where electron-store (theme) and lowdb (tabs) competed for the same
app-state.jsonfile - Remove electron-store dependency entirely
Changes
- Add tRPC
uiStaterouter withtabs.get/setandtheme.get/setprocedures - Create
trpc-storageadapter for Zustand persist middleware - Update tabs and theme stores to use tRPC-based storage
- Fix
appState.update()bug (lowdb's JSONFilePreset doesn't have update method) - Add
layoutfield to tab Zod schema to preserve MosaicNode layouts
Test plan
- Verify tabs persist and restore correctly after app restart
- Verify theme changes persist and restore correctly
- Verify pane layouts (splits) are preserved
- Verify no race conditions between tabs and theme saves
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
-
New Features
- Introduced centralized UI state persistence for tabs and theme preferences.
- Enhanced notification system with improved workspace context derivation.
-
Improvements
- Refactored terminal session identification for better pane tracking and stability.
- Upgraded app state persistence layer for improved reliability.
-
Chores
- Migrated storage backend to a new internal persistence system.
✏️ Tip: You can customize this high-level summary in your review settings.