fix: derive green pallino from git status instead of in-memory tracker
The green dot (new note indicator) was disappearing after Cmd+S because markSaved cleared it from the in-memory newPaths set. Now resolveNoteStatus derives "new" status from git status (untracked/added files) so the green dot persists until the note is committed. The in-memory tracker is only used for the brief window between note creation and first save to disk. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,6 @@ interface EditorSaveConfig {
|
||||
setTabs: (fn: SetStateAction<any[]>) => void
|
||||
setToastMessage: (msg: string | null) => void
|
||||
onAfterSave?: () => void
|
||||
onNoteSaved?: (path: string) => void
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,7 +21,7 @@ interface EditorSaveConfig {
|
||||
*/
|
||||
const noop = () => {}
|
||||
|
||||
export function useEditorSave({ updateVaultContent, setTabs, setToastMessage, onAfterSave = noop, onNoteSaved }: EditorSaveConfig) {
|
||||
export function useEditorSave({ updateVaultContent, setTabs, setToastMessage, onAfterSave = noop }: EditorSaveConfig) {
|
||||
const pendingContentRef = useRef<{ path: string; content: string } | null>(null)
|
||||
|
||||
const updateTabAndContent = useCallback((path: string, content: string) => {
|
||||
@@ -41,9 +40,8 @@ export function useEditorSave({ updateVaultContent, setTabs, setToastMessage, on
|
||||
if (pathFilter && pending.path !== pathFilter) return false
|
||||
await saveNote(pending.path, pending.content)
|
||||
pendingContentRef.current = null
|
||||
onNoteSaved?.(pending.path)
|
||||
return true
|
||||
}, [saveNote, onNoteSaved])
|
||||
}, [saveNote])
|
||||
|
||||
/** Called by Cmd+S — persists the current editor content to disk */
|
||||
const handleSave = useCallback(async () => {
|
||||
|
||||
Reference in New Issue
Block a user