Bugfix: Why does the live preview show "Ready to compile" even when ...
Documentation for Sessions
🐛 Bugfix: Why does the live preview show "Ready to compile" even when ...
Date: 2026-03-17
Time: 20:05:22 UTC
Session: gspace1-231.2
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why does the live preview show "Ready to compile" even when modules exist in the universe?
Task: Fix live preview not rendering platform when opening studio with existing modules
🎯 Decision Made
Chosen:
Three targeted fixes: (1) VfsSyncService emits modulesLoaded$ via forkJoin after ALL file contents are in VFS, not just after the module slug list arrives. (2) Remove arbitrary 1500ms timer from StudioDockShellComponent. (3) PreviewService.compileRspack pushes compiled assets even when errors exist.
Options Considered:
- Increase timer to 5000ms (hacky, unreliable)
- Add retry logic to compileRspack (band-aid)
- forkJoin to emit after all files loaded (root cause fix)
💭 Reasoning
Root cause was a race condition: modulesLoaded$ fired immediately after the GitLab /modules list API responded, but before individual file content fetches completed. compileRspack() calls detectModulesInVfs() which looks for .routes.ts files — if those fetches hadn't completed, 0 modules detected → early return with no compilation. The 1500ms timer was a workaround that was too short for 5+ modules with 10-50 files each via GitLab API. Fix: use forkJoin to track all file fetch observables and only emit the signal when everything is in VFS.
📁 Files Involved
libs/libs-structural/vitto-studio/src/lib/services/vfs-sync.service.tslibs/libs-structural/vitto-studio/src/lib/components/studio-dock-shell/studio-dock-shell.component.tslibs/libs-structural/vitto-studio/src/lib/services/preview.service.ts
🔗 Related
- Decision ID:
dev_1773777922817_cu0gzht - Session: 231
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation