mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-16 05:36:00 +02:00
more fixes to list filters
This commit is contained in:
@@ -155,23 +155,28 @@ export const useAlbumListFilters = () => {
|
||||
|
||||
const setCustom = useCallback(
|
||||
(value: null | Record<string, any>) => {
|
||||
setSearchParams((prev) => {
|
||||
const previousValue = prev.get(FILTER_KEYS.ALBUM._CUSTOM);
|
||||
setSearchParams(
|
||||
(prev) => {
|
||||
const previousValue = prev.get(FILTER_KEYS.ALBUM._CUSTOM);
|
||||
|
||||
const newCustom = {
|
||||
...(previousValue ? JSON.parse(previousValue) : {}),
|
||||
...value,
|
||||
};
|
||||
const newCustom = {
|
||||
...(previousValue ? JSON.parse(previousValue) : {}),
|
||||
...value,
|
||||
};
|
||||
|
||||
const filteredNewCustom = Object.fromEntries(
|
||||
Object.entries(newCustom).filter(
|
||||
([, value]) => value !== null && value !== undefined,
|
||||
),
|
||||
);
|
||||
const filteredNewCustom = Object.fromEntries(
|
||||
Object.entries(newCustom).filter(
|
||||
([, value]) => value !== null && value !== undefined,
|
||||
),
|
||||
);
|
||||
|
||||
prev.set(FILTER_KEYS.ALBUM._CUSTOM, JSON.stringify(filteredNewCustom));
|
||||
return prev;
|
||||
});
|
||||
prev.set(FILTER_KEYS.ALBUM._CUSTOM, JSON.stringify(filteredNewCustom));
|
||||
return prev;
|
||||
},
|
||||
{
|
||||
replace: true,
|
||||
},
|
||||
);
|
||||
},
|
||||
[setSearchParams],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user