fix(app): prevent stale save prompts after visual saves - #312
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
Why
Issue #308 reports that Markra can show “saved” while still prompting to discard unsaved changes on close or root-folder switching. The root cause is a save-state race: after a clean save, an old visual editor instance can still expose or emit the pre-save markdown before the refreshed editor is ready.
Validation
pnpm --filter @markra/app exec vitest run src/hooks/useMarkdownDocument.test.tsxpassed: 40 tests.pnpm --filter @markra/app exec vitest run src/App.test.tsx -t "wires native menu file actions to the current document commands"passed: 1 test, 154 skipped.pnpm --filter @markra/app exec vitest run src/App.test.tsx -t "switches away from a clean file with normalized markdown without asking to discard changes"passed: 1 test, 154 skipped.pnpm --filter @markra/app buildpassed.pnpm --filter @markra/app testpassed: 84 files, 1206 tests.Risk
Low. The refresh is limited to successful saves that actually change the document’s clean baseline, path, or name. Clean inactive visual tab updates with matching revision are ignored only when they would make a previously clean tab dirty from visual serialization/stale content.
Related Issues
Refs #308