mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 14:27:26 +00:00
The fix the cutover-dashboard investigation this week was building toward. Proven 2026-09-23: `refreshFileTree` (useFileTree) is only ever called from Studio's OWN file operations (create/delete/rename/upload/block install) — never on an external change. An agent removing or replacing a composition updates the preview and the SDK session (useExternalFileChangeCoordinator already reloads both) but never the tree, so the file stays listed and clickable forever. Opening it opens a session that can never resolve (`reason: "absent"`), every edit through it silently takes the (also failing) server path, and nothing tells the user why. Two refresh triggers, belt and braces: - `useExternalFileChangeCoordinator` gains an optional `refreshFileTree` collaborator, called alongside `reloadPreview`/`reloadSdkSession` on every accepted external change — closes staleness at the source, for every consumer of the tree, not just the SDK read. Wired through `useStudioExternalFileChanges` from `fileManager.refreshFileTree` (already in scope there). - `useSdkSession` gains `onAbsentRead`, called once per (projectId, path) when a read reports `reason: "absent"` — the fallback for a change the SSE never delivered (server restart, a missed watcher event). Guarded by a ref-tracked set so a genuinely-gone file can't loop, cleared on project change so a different project's identical path can still fire. New: `sdkHandle.compositionMissing`, true for exactly that read result on the currently active path, and `CompositionMissingBanner` — sibling of `ProjectUnreachableBanner` (that one fires when the whole PROJECT is unreachable; this one when the project is fine and this one file inside it is not) — shown in App.tsx alongside it. The read failure alone is silent; this is what tells the user their edits stopped landing. Deliberately not touched: `activeCompPath` is never cleared when the path leaves the tree — the graveyard page (`clearing-activecomppath-on-tree- absence`) is binding, and its reasons still hold (`useAutoOpenRootComposition` latches once; a null path never recovers). Tests: coordinator refresh fires once per accepted change, not for a self-write echo, and no-ops when the collaborator is absent (4 new). useSdkSession: compositionMissing set/cleared, onAbsentRead once per path, fires again for a different path, guard resets on project change, no-ops without the collaborator (5 new). Banner render test (1 new). 25/25 in the touched suites; 2830/2831 across studio hooks+components overall (the one failure is a pre-existing happy-dom `window.confirm` gap in ExternalFileConflictBanner.test.tsx, confirmed unrelated via git stash). oxlint, oxfmt, tsc --noEmit clean. Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>