fix(files): address autosave migration and review regressions

Seed omitted autoSaveEnabled from the hydrated client preference (including
legacy localStorage) instead of resetting everyone to enabled. Restore SVG
non-editable flags, treat clean draft saves as success, and throw again from
disposed content-cache owners while keeping runtime-switch cache invalidation.

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-07-30 11:29:37 +00:00
co-authored by Serhii Dziupin
parent fc4db0c656
commit be572c1692
7 changed files with 85 additions and 39 deletions
+8 -2
View File
@@ -38,12 +38,18 @@ export type FileEditorSaveDraftGate = {
};
/**
* Whether saveDraft may write. Refuses empty drafts against stale content and any binary target.
* Whether saveDraft may proceed.
* - Clean drafts return true ("nothing to save" is success) so callers like the
* unsaved-changes dialog and Ctrl+S do not treat a no-op as failure.
* - Incomplete loads and binary targets return false (refused).
*/
export function shouldAllowFileDraftSave(gate: FileEditorSaveDraftGate): boolean {
if (!gate.selectedFilePath || !gate.isDirty) {
if (!gate.selectedFilePath) {
return false;
}
if (!gate.isDirty) {
return true;
}
if (gate.fileLoading || gate.loadedFilePath !== gate.selectedFilePath || gate.isNonEditableBinary) {
return false;
}