fix: emitNoteChange après enableNoteHistory — carte se met à jour
enableNoteHistory() mettait à jour la DB mais ne notifiait pas la home page.
L'éditeur fetch la note à jour (historyEnabled=true) → icône visible.
La home gardait les données en cache (historyEnabled=false) → pas d'icône.
Fix: emitNoteChange({ type: 'updated', note: { ...note, historyEnabled: true } })
dispatché après les 2 points d'appel dans note-document-info-panel.tsx.
This commit is contained in:
@@ -16,6 +16,7 @@ import { NoteHistoryModal } from './note-history-modal'
|
||||
import { NoteNetworkTab } from './note-network-tab'
|
||||
import { NoteEditorPropertiesPanel } from './structured-views/note-editor-properties-panel'
|
||||
import { enableNoteHistory, commitNoteHistory, getNoteHistory, deleteNoteHistoryEntry, restoreNoteVersion } from '@/app/actions/notes'
|
||||
import { emitNoteChange } from '@/lib/note-change-sync'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
type Tab = 'info' | 'versions' | 'network'
|
||||
@@ -332,6 +333,7 @@ export function NoteDocumentInfoPanel({ note, content, onClose, onNoteRestored }
|
||||
await enableNoteHistory(note.id)
|
||||
setHistoryEnabled(true)
|
||||
setShowHistory(true)
|
||||
emitNoteChange({ type: 'updated', note: { ...note, historyEnabled: true } })
|
||||
}}
|
||||
>
|
||||
{t('documentInfo.enableHistory')}
|
||||
@@ -481,6 +483,7 @@ export function NoteDocumentInfoPanel({ note, content, onClose, onNoteRestored }
|
||||
onEnableHistory={async () => {
|
||||
await enableNoteHistory(note.id)
|
||||
setHistoryEnabled(true)
|
||||
emitNoteChange({ type: 'updated', note: { ...note, historyEnabled: true } })
|
||||
}}
|
||||
onRestored={(restored) => {
|
||||
setShowHistory(false)
|
||||
|
||||
Reference in New Issue
Block a user