fix catalog filter counts persistence between subplebbits and page refreshes

This commit is contained in:
Tom (plebeius.eth)
2025-03-06 18:07:44 +01:00
parent 0faaa4982a
commit ad60404792
4 changed files with 66 additions and 8 deletions
@@ -56,6 +56,20 @@ const FiltersTable = ({ onSave }: { onSave: () => void }) => {
onSave();
}, [saveAndApplyFilters, localFilterItems, onSave]);
const handleKeyDown = useCallback(
(e: KeyboardEvent) => {
if (e.key === 'Enter') {
handleSave();
}
},
[handleSave],
);
useEffect(() => {
document.addEventListener('keydown', handleKeyDown);
return () => document.removeEventListener('keydown', handleKeyDown);
}, [handleKeyDown]);
const updateLocalFilterItem = useCallback((index: number, item: any) => {
setLocalFilterItems((prev) => prev.map((f, i) => (i === index ? item : f)));
}, []);