diff --git a/interface/app/$libraryId/Explorer/Search/index.tsx b/interface/app/$libraryId/Explorer/Search/index.tsx index 2589ece8bb27..fa316908f387 100644 --- a/interface/app/$libraryId/Explorer/Search/index.tsx +++ b/interface/app/$libraryId/Explorer/Search/index.tsx @@ -1,7 +1,7 @@ import { CaretRight, FunnelSimple, Icon, Plus } from '@phosphor-icons/react'; import { IconTypes } from '@sd/assets/util'; import clsx from 'clsx'; -import { memo, PropsWithChildren, useDeferredValue, useState } from 'react'; +import { memo, PropsWithChildren, useDeferredValue, useEffect, useState } from 'react'; import { Button, ContextMenuDivItem, DropdownMenu, Input, RadixCheckbox, tw } from '@sd/ui'; import { useKeybind } from '~/hooks'; @@ -10,6 +10,7 @@ import { useSearchContext } from './Context'; import { filterRegistry, SearchFilterCRUD, useToggleOptionSelected } from './Filters'; import { getSearchStore, + resetSearchStore, useRegisterSearchFilterOptions, useSearchRegisteredFilters, useSearchStore @@ -92,6 +93,10 @@ const SearchOptions = () => { useRegisterSearchFilterOptions(filter, options); } + useEffect(() => { + return () => resetSearchStore(); + }, []); + return (
{ diff --git a/interface/app/$libraryId/Explorer/Search/store.tsx b/interface/app/$libraryId/Explorer/Search/store.tsx index 448170cbe8b3..6502a639b4fd 100644 --- a/interface/app/$libraryId/Explorer/Search/store.tsx +++ b/interface/app/$libraryId/Explorer/Search/store.tsx @@ -148,6 +148,7 @@ export const useSearchRegisteredFilters = (query: string) => { export const resetSearchStore = () => { searchStore.searchQuery = null; searchStore.filterArgs = ref([]); + searchStore.filterArgsKeys = ref(new Set()); }; export const useSearchStore = () => useSnapshot(searchStore);