Architecture: Where should Vitto Studio dock layout presets persist: gogra...
Documentation for Sessions
🏗️ Architecture: Where should Vitto Studio dock layout presets persist: gogra...
Date: 2026-03-21
Time: 19:38:47 UTC
Session: gspace1-253.4
Agent: backend
Confidence: 90%
Status: ✅ Documented
📋 Decision Context
Question:
Where should Vitto Studio dock layout presets persist: gograb-api global user_preferences vs per-space Mongo database?
Task: Institutional knowledge: dock cloud sync storage location and operator troubleshooting
🎯 Decision Made
Chosen:
Per-space database: collection user_preferences, document _id user-pref-{userId}, path preferences.dockLayoutPresetsByStorageKey[storageKey] (e.g. vitto-studio-dock-layout-v2). Implemented via SpaceDatabasePreferencesService.mergeDockLayoutPresetStore and DockLayoutPresetsController.
Options Considered:
- Global gograb-api UserPreferences with dockLayoutPresetsBySpaceId
- Per-space DB user_preferences (chosen)
- Hybrid: global default + per-space override
💭 Reasoning
Root issue: two different concepts share the name user_preferences—global Mongoose doc (cross-space profile) vs space-scoped prefs. Dock is workspace-specific: different panels per tenant, data locality with space lifecycle, aligns with existing saveUserSpacePreferences in the same collection. Alternative global storage would need spaceId namespacing and mixes large blobs into hot merged-prefs paths. User confusion (Atlas not showing data) was often UI refresh or scrolling past many universe_* collections; wrong-DB hypothesis was overused—in validated case space_chrome-space-1_* was correct. Prevention: document explicitly that operators must open the space_* database, collection user_preferences, not only the main DB; refresh after first cloud sync write.
📁 Files Involved
APIs/backend-api/src/app/spaces/space-database/services/space-database-preferences.service.tsAPIs/backend-api/src/app/spaces/space-database/services/space-database-collections.service.tslibs/libs-ui/dock-layout/src/lib/services/dock-layout.service.ts
🔗 Related
- Decision ID:
dev_1774121927762_tim55j2 - Session: 253
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation