From a7e3646ae62fcd00e86c102abd8328d336b1800e Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sat, 4 Jul 2026 20:56:51 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20home-client=20=C3=A9coute=20NOTE=5FCHANG?= =?UTF-8?q?E=5FEVENT=20=E2=80=94=20versioning=20indicator=20visible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: home-client.tsx n'écoutait PAS NOTE_CHANGE_EVENT. Quand versioning était activé depuis l'éditeur, emitNoteChange était dispatché mais personne ne mettait à jour la liste des notes → historyEnabled restait false sur les cartes/liste. Fix: useEffect qui écoute NOTE_CHANGE_EVENT et patch les notes + pinnedNotes avec les champs mis à jour (historyEnabled, etc.). --- memento-note/components/home-client.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/memento-note/components/home-client.tsx b/memento-note/components/home-client.tsx index e1763a9..ec096f8 100644 --- a/memento-note/components/home-client.tsx +++ b/memento-note/components/home-client.tsx @@ -21,7 +21,7 @@ import { import { NotebookSuggestionToast } from '@/components/notebook-suggestion-toast' import { Button } from '@/components/ui/button' import { Plus, ArrowUpDown, Search, Sparkles, FileText, FolderOpen, ChevronRight, ChevronDown, Tag as TagIcon, X, Menu, LayoutGrid, List, Table, Columns3, CalendarDays, Wand2, Download, Upload, Globe } from 'lucide-react' -import { emitNoteChange } from '@/lib/note-change-sync' +import { emitNoteChange, NOTE_CHANGE_EVENT, type NoteChangeEvent } from '@/lib/note-change-sync' import { useReminderCheck } from '@/hooks/use-reminder-check' import { useAutoLabelSuggestion } from '@/hooks/use-auto-label-suggestion' import { useNotebooks } from '@/context/notebooks-context' @@ -611,6 +611,20 @@ export function HomeClient({ }) }, [patchNoteInList]) + // Écoute les mutations externes (versioning activé depuis éditeur, etc.) + useEffect(() => { + const onNoteChange = (e: Event) => { + const detail = (e as CustomEvent).detail + if (!detail) return + if (detail.type === 'updated') { + patchNoteInList(detail.note.id, detail.note) + setPinnedNotes(prev => prev.map(n => n.id === detail.note.id ? { ...n, ...detail.note } : n)) + } + } + window.addEventListener(NOTE_CHANGE_EVENT, onNoteChange) + return () => window.removeEventListener(NOTE_CHANGE_EVENT, onNoteChange) + }, [patchNoteInList]) + const handleGridReorder = useCallback( async (orderedIds: string[]) => { setSortOrder('manual')