Skip to content

Commit ed09ee7

Browse files
ozgesolidkeyclaude
andcommitted
Fix annotation clear not persisting to disk when currentFileUsesLocalStorage=false
clearAnnotations was silently skipping disk write when the file was opened in read-only mode or before the local storage flag was set. Now always attempts to persist via loadLocalFileData/saveLocalFileData fallback path. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3060da1 commit ed09ee7

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

src/main/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,18 @@ function loadAnnotationsForFile(filePath: string): void {
580580
}
581581

582582
function saveAnnotationsForCurrentFile(): void {
583-
if (!currentFilePath || !currentFileUsesLocalStorage) return;
583+
if (!currentFilePath) return;
584+
// Try local storage first, fall back to global ~/.logan storage
585+
if (!currentFileUsesLocalStorage) {
586+
// Still attempt to save using the fallback path so clears persist
587+
try {
588+
const localData = loadLocalFileData(currentFilePath);
589+
localData.annotations = Array.from(annotations.values())
590+
.sort((a, b) => a.lineNumber - b.lineNumber);
591+
saveLocalFileData(currentFilePath, localData);
592+
} catch { /* read-only fs — annotations not persisted */ }
593+
return;
594+
}
584595
const localData = loadLocalFileData(currentFilePath);
585596
localData.annotations = Array.from(annotations.values())
586597
.sort((a, b) => a.lineNumber - b.lineNumber);

0 commit comments

Comments
 (0)