Skip to content

fix(app): don't auto-restore a draft when the entry has changed since - #1641

Open
olivergeorge wants to merge 1 commit into
Thinkmill:mainfrom
olivergeorge:fix/stale-draft-overwrite
Open

olivergeorge wants to merge 1 commit into
Thinkmill:mainfrom
olivergeorge:fix/stale-draft-overwrite

Conversation

@olivergeorge

Copy link
Copy Markdown

Fixes #1594.

Drafts were restored over the loaded entry unconditionally, so a draft from an earlier session could hide newer content on disk (or on GitHub) and pressing Save would overwrite it. The only signal was a transient "Restored draft" toast.

Drafts already store the tree key they were made against. A draft is now only restored automatically when that matches the current tree key. Otherwise the saved entry is shown, with a toast offering "Restore draft". The stale draft is kept until it's restored or the user makes their own changes.

Fixes Thinkmill#1594.

Drafts were restored over the loaded entry unconditionally, so a draft
from an earlier session could hide newer content on disk (or on GitHub)
and pressing Save would overwrite it. The only signal was a transient
"Restored draft" toast.

Drafts already store the tree key they were made against. A draft is now
only restored automatically when that matches the current tree key.
Otherwise the saved entry is shown, with a toast offering "Restore draft".
The stale draft is kept until it's restored or the user makes their own
changes.
@changeset-bot

changeset-bot Bot commented Oct 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: a6407e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@keystatic/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A stale local draft shadows the file on disk; saving in that state overwrites the real content

1 participant