+ React.useEffect(() => {
+ const savedFilter = localStorage.getItem(`content.filter.${type}`);
+ if (savedFilter) {
+ setFilter(JSON.parse(savedFilter));
+ } else {
+ setFilter(filter => filter ? {} : filter);
+ }
+ }, [type]);
+
+ const updateFilter = React.useCallback(newFilter => {
+ localStorage.setItem(`content.filter.${type}`, JSON.stringify(newFilter));
+ setFilter(newFilter);
+ }, [type]);
+