Skip to content

fix(app): prevent stale save prompts after visual saves - #312

Merged
murongg merged 1 commit into
mainfrom
fix/issue-308-save-prompt
Jun 17, 2026
Merged

fix(app): prevent stale save prompts after visual saves#312
murongg merged 1 commit into
mainfrom
fix/issue-308-save-prompt

Conversation

@murongg

@murongg murongg commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Refresh saved visual-editor documents after a successful save so stale editor contents are not read during close or folder switching.
  • Ignore stale clean visual updates from inactive document tabs after a save.
  • Add regression coverage for native close and inactive-tab save prompt races.

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.tsx passed: 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 build passed.
  • pnpm --filter @markra/app test passed: 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

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markra-web Ready Ready Preview, Comment Jun 17, 2026 11:12am

@murongg
murongg marked this pull request as ready for review June 17, 2026 11:16
@murongg
murongg merged commit 60eee57 into main Jun 17, 2026
4 checks passed
@murongg
murongg deleted the fix/issue-308-save-prompt branch June 17, 2026 11:16
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.

1 participant