[bugfix]: queue all songs on search, consistent sort, clearing

- Previously, the search page would render initial page in one order, but search itself would be different order
This is resolved by having both virtual-table and search-header using listStoreKey
- When double clicking, now enqueue all the songs using the same sort
- Reset the search when clearing
This commit is contained in:
Kendall Garner 2024-03-31 13:20:01 -07:00
parent 918842e3a5
commit 8900d8126c
No known key found for this signature in database
GPG key ID: 18D2767419676C87
2 changed files with 18 additions and 9 deletions

View file

@ -11,6 +11,7 @@ import { FilterBar, LibraryHeaderBar } from '/@/renderer/features/shared';
import { useContainerQuery } from '/@/renderer/hooks';
import { useListFilterRefresh } from '/@/renderer/hooks/use-list-filter-refresh';
import { AppRoute } from '/@/renderer/router/routes';
import { useListStoreByKey } from '/@/renderer/store';
interface SearchHeaderProps {
navigationId: string;
@ -23,6 +24,7 @@ export const SearchHeader = ({ tableRef, navigationId }: SearchHeaderProps) => {
const [searchParams, setSearchParams] = useSearchParams();
const cq = useContainerQuery();
const server = useCurrentServer();
const { filter } = useListStoreByKey({ key: itemType });
const { handleRefreshTable } = useListFilterRefresh({
itemType,
@ -30,9 +32,8 @@ export const SearchHeader = ({ tableRef, navigationId }: SearchHeaderProps) => {
});
const handleSearch = debounce((e: ChangeEvent<HTMLInputElement>) => {
if (!e.target.value) return;
setSearchParams({ query: e.target.value }, { replace: true, state: { navigationId } });
handleRefreshTable(tableRef, { searchTerm: e.target.value });
handleRefreshTable(tableRef, { ...filter, searchTerm: e.target.value });
}, 200);
return (