Skip to content

Commit e889725

Browse files
Fix file switching blocked by stale dirty state from previous file
When navigating via sidebar while editing a file, the global editorDirty flag from the previous file incorrectly triggered the "File changed on disk" defer logic for the newly opened file. Skip the defer check for intentional frontend navigations and reset dirty state on switch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 92318db commit e889725

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

web/src/App.svelte

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -914,10 +914,13 @@
914914
pruneTabsForRemovedPaths(removedPaths);
915915
}
916916
if (detectFileType(data.filePath) === 'markdown' && typeof data.markdown !== 'string') {
917-
if (mode === 'edit' && data.filePath === activePath && editorDirty) {
917+
if (!wasFrontendNav && mode === 'edit' && data.filePath === activePath && editorDirty) {
918918
deferExternalReload(data.filePath, data.contentMtimeMs);
919919
return;
920920
}
921+
if (wasFrontendNav) {
922+
editorDirty = false;
923+
}
921924
void loadMarkdownForPath(data.filePath, data.contentMtimeMs);
922925
}
923926
}

0 commit comments

Comments
 (0)