From 7f9e31eec3e8d9ad545feb106f7b7282c4799f80 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sun, 31 May 2026 01:06:44 +0200 Subject: [PATCH] fix(navigator): drop vestigial TanStack invalidateQueries from useNavigatorSearch The hook is the useState/useMessageEvent variant; the leftover useQueryClient().invalidateQueries call required a QueryClientProvider the unit test didn't supply (6 failures). The FlatCreatedEvent handler already re-sends the search composer, so the invalidate was dead code. --- src/hooks/navigator/useNavigatorSearch.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/hooks/navigator/useNavigatorSearch.ts b/src/hooks/navigator/useNavigatorSearch.ts index fa5e021..cbbadc2 100644 --- a/src/hooks/navigator/useNavigatorSearch.ts +++ b/src/hooks/navigator/useNavigatorSearch.ts @@ -1,5 +1,4 @@ import { FlatCreatedEvent, NavigatorSearchComposer, NavigatorSearchEvent, NavigatorSearchResultSet } from '@nitrots/nitro-renderer'; -import { useQueryClient } from '@tanstack/react-query'; import { useEffect, useState } from 'react'; import { SendMessageComposer } from '../../api'; import { useMessageEvent } from '../events'; @@ -23,7 +22,6 @@ export const useNavigatorSearch = () => { const tabCode = useNavigatorUiStore(s => s.currentTabCode); const filter = useNavigatorUiStore(s => s.currentFilter); - const queryClient = useQueryClient(); const [ searchResult, setSearchResult ] = useState(null); const [ isFetching, setIsFetching ] = useState(false); @@ -49,11 +47,9 @@ export const useNavigatorSearch = () => setIsFetching(false); }); - // A newly created room invalidates the current search so it refetches. + // A newly created room refetches the current search. useMessageEvent(FlatCreatedEvent, () => { - queryClient.invalidateQueries({ queryKey: [ 'navigator', 'search' ] }); - if(!tabCode) return; setIsFetching(true);