editor: a failed scene load shows an error with retry, never an empty scene - #759
Merged
Conversation
…mpty scene A host `onLoad` that rejects (failed fetch, timeout) used to fall through to `applySceneGraphToEditor(null)`, i.e. the default site/building/level scaffold. The autosave loop re-baselined on that cleared store, the next store touch armed a save, and the scaffold was written over the real project. Prod audit 2026-09-02: 10–100 such wipes per day; 11–13 % of forks and template starts opened over two weeks lost their copied scene on the first save. Now a failed load keeps the store unloaded and the autosave loop in its loading state (nothing can be written), and renders `SceneLoadFailed` with a retry that re-runs the load effect. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DLB54VYmGTzvyHNFb3wWxE
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: bbbadd8f-56e3-4711-be2c-965dd68ce644 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
A host
onLoadthat rejects (failed fetch, timeout) used to fall through toapplySceneGraphToEditor(null), i.e. the default site/building/level scaffold. The autosave loop re-baselined its wipe guard on that cleared store, the next store touch (host-panelinstalledPluginssync, a plugin tick) armed a save, and the scaffold was written over the real project.Prod audit on the hosted editor, 2026-09-02: 10–100 such wipes per day; 11–13 % of forks and template starts opened over two weeks lost their copied scene on the first save (scene fetch p95 is ~20 s against a 3 × 8 s host timeout).
Now a failed load keeps the store unloaded and the autosave loop in its loading state, so nothing can be written, and renders a new
SceneLoadFailedoverlay whose "Try again" re-runs the load effect. A load that resolvesnull(a genuinely empty project) is unchanged.Companion host-side PR in
private-editoradds a server-side wipe guard and makes the hostonLoadthrow on a failed fetch.How to test
onLoadreject or hang past its timeout — e.g. stall the scene fetch in devtools.[autosave]console lines); the persisted scene is untouched.bun test packages/editor/src/hooks/use-auto-save.test.tsstill passes;bun x tsgo --noEmit -p packages/editor/tsconfig.jsonis clean (needs a fresh core/viewer dist).Verified end to end with a headless Playwright probe against the hosted editor on a local stack: stalled fetch → overlay, 0 autosave writes, DB row untouched → retry loads the scene.
Screenshots / screen recording
Overlay: centred "This project couldn't be loaded — Nothing was changed. Check your connection and try again." with a rounded "Try again" button over the editor shell. (Probe screenshot available on request; the dev build's component-outline overlay makes it noisy.)
Checklist
bun devbun checkto verify)mainbranch🤖 Generated with Claude Code
https://claude.ai/code/session_01DLB54VYmGTzvyHNFb3wWxE
Note
High Risk
Touches initial scene load and autosave gating—core persistence path where the prior behavior caused production scene wipes; the change reduces that risk but must behave correctly on every failure mode.
Overview
Failed host
onLoadno longer falls back to the default scaffold, which could be autosaved over the real project. On rejection, the scene store stays unloaded,isLoadingSceneRefstays true so autosave does not run, andhasLoadedInitialSceneis not set until a load succeeds.The full-screen loader is replaced by a new
SceneLoadFailedoverlay (“This project couldn't be loaded” + Try again). Retry bumpssceneLoadAttemptto re-run the load effect. A resolvednull(intentionally empty project) is unchanged.Both v1 and v2 layouts use the same error-vs-loader branch.
Reviewed by Cursor Bugbot for commit be59897. Bugbot is set up for automated code reviews on this repo. Configure here.