mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 15:06:20 +00:00
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.
This commit is contained in:
@@ -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<NavigatorSearchResultSet | null>(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>(FlatCreatedEvent, () =>
|
||||
{
|
||||
queryClient.invalidateQueries({ queryKey: [ 'navigator', 'search' ] });
|
||||
|
||||
if(!tabCode) return;
|
||||
|
||||
setIsFetching(true);
|
||||
|
||||
Reference in New Issue
Block a user