Recover a bad change
Undo a build that went the wrong way using version history, rollback, and clone.
Sometimes a prompt takes the app somewhere you did not want to go. A button moves, a page breaks, a schema changes. This guide shows you how to undo it without losing the good work around it.
Decide what to do first
Before touching anything, pick the right tool for the situation.
- The change broke the build — read Troubleshooting build failures first. You may just need the Fix Build button.
- The build works but the change is wrong — roll back to the previous version (below).
- You want to keep exploring but not lose the current state — clone the project, then roll back the clone.
- Only part of the change is wrong — do not roll back. Describe the correction in chat.
Roll back to a previous version
Every successful build is saved as a version. Rolling back makes an older version the new head, so the next message builds from there.
Open version history
Click the clock icon in the top bar. The panel lists every version, newest first. The current version is tagged current. A published version is tagged published.
Preview a past version
Click any version in the list. The preview switches to that version without changing anything else. Use this to find the last version that was good.
Click Revert
Hover the version you want and click the revert icon. Confirm in the dialog. Layout reverts the project and shows "Reverted to Version N".
Rollback is not destructive. Versions you leave behind stay in history, grouped under "reverted edits" — you can jump back forward any time.
After the rollback
Once you are back on a good version, the next prompt you send builds from there. That means:
- The broken change is out of the way
- Your chat history still shows the whole story, including the mistake
- You can describe the change again with more detail, or break it into smaller pieces
Earlier I asked to "redesign the dashboard" and it rewrote too much.
Instead, change only the header: add a user avatar on the right and
move the search bar to the center.When to clone instead of roll back
Cloning creates a new project with its own history. Use it when:
- You want to try a risky change without risking the current project
- You want to keep the bad-but-interesting version around for reference
- You want to branch the app in two directions (a staging copy)
Open the project name dropdown in the top-left and pick Clone. The new copy opens in a new tab.
If the bad change is already published
Rolling back in the editor does not touch the published site. The published URL keeps serving the old good version until you push an update.
To publish the rollback:
- Roll back in the editor
- Open the publish panel
- Click Publish
To keep the published site as-is while you experiment, roll back and skip the publish step.
What rollback will not fix
- External state. If a build wrote rows to the database, rolling back the code does not delete them. Clean up the data by hand or ask the AI for a migration that does it.
- Connected Supabase projects. If you connected your own Supabase, the schema lives in your account. Rollback reverts Layout's view of the schema — the actual tables in Supabase stay where the AI last pushed them.
- Published subdomains. See above — rollback is editor-only until you publish the update.