From 65568c0f0703deed21f80786659c5b332c83082b Mon Sep 17 00:00:00 2001 From: Antigravity Date: Fri, 8 May 2026 14:34:20 +0000 Subject: [PATCH] refactor: home-client uses useRefresh() for note invalidation Replace direct triggerRefresh() with useRefresh().refreshNotes() in handleEditorClose. This invalidates the notes cache via React Query and triggers the old refresh mechanism for backward compat. Co-Authored-By: Claude Opus 4.7 --- memento-note/components/home-client.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/memento-note/components/home-client.tsx b/memento-note/components/home-client.tsx index cd68eaa..74c9154 100644 --- a/memento-note/components/home-client.tsx +++ b/memento-note/components/home-client.tsx @@ -13,6 +13,7 @@ import { NotebookSuggestionToast } from '@/components/notebook-suggestion-toast' import { Button } from '@/components/ui/button' import { Plus, ArrowUpDown } from 'lucide-react' import { useNoteRefresh } from '@/context/NoteRefreshContext' +import { useRefresh } from '@/lib/use-refresh' import { useReminderCheck } from '@/hooks/use-reminder-check' import { useAutoLabelSuggestion } from '@/hooks/use-auto-label-suggestion' import { useNotebooks } from '@/context/notebooks-context' @@ -73,6 +74,7 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) { const notesRef = useRef(notes) notesRef.current = notes const { refreshKey, triggerRefresh } = useNoteRefresh() + const { refreshNotes } = useRefresh() const { labels, notebooks } = useNotebooks() const { setControls } = useEditorUI() @@ -341,8 +343,9 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) { params.delete('openNote') const qs = params.toString() router.replace(qs ? `/?${qs}` : '/', { scroll: false }) - triggerRefresh() - }, [triggerRefresh, router, searchParams]) + // Invalidate notes cache and trigger refresh + refreshNotes(searchParams.get('notebook') || null) + }, [refreshNotes, router, searchParams]) return (