mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
fix(web): reset sourceEverLoadedRef on file/project switch
`sourceEverLoadedRef` was marked as permanently-true once set, meaning it never reset when the user navigated to a different file or project. The render guard at the loading skeleton checks `source === null && !sourceEverLoadedRef.current`; with the ref stuck at `true`, a file/project switch skipped the loading skeleton entirely while `source` was still null, leaving a blank iframe visible during a slow fetch. Fix: reset `sourceEverLoadedRef.current = false` in the existing file/project-switch reset effect (deps: `[projectId, file.name]`). The fetch effect sets it back to `true` only after the current file's source arrives successfully — exactly as before. Codex P2 finding. Refs #4650
This commit is contained in:
@@ -5371,6 +5371,12 @@ function HtmlViewer({
|
||||
setCommentPanelOpen(false);
|
||||
setCommentCreateMode(false);
|
||||
setActivePreviewCommentId(null);
|
||||
// Reset the "ever loaded" sentinel so the loading skeleton is shown again
|
||||
// while the new file's source is being fetched. Without this reset the
|
||||
// sentinel stays true from the previous file, the render guard skips the
|
||||
// skeleton, and a slow fetch leaves the user staring at a blank iframe
|
||||
// instead of the loading indicator (codex P2 finding, issue #4650).
|
||||
sourceEverLoadedRef.current = false;
|
||||
}, [projectId, file.name]);
|
||||
const activePreviewSrcUrl = (
|
||||
previewSrcUrl === effectiveBasePreviewSrcUrl ||
|
||||
|
||||
Reference in New Issue
Block a user