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 (