Skip to content

Commit

Permalink
Try to fix filter sidebar bug (#1178)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmohan authored Jan 27, 2025
1 parent 36b3f06 commit fd2907b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/pages/collection/Collection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,22 @@ function Collection() {
const { showRandomPoster } = settings.WebUI_Settings.collection.image;

const [mode, setMode] = useState<'poster' | 'list'>('poster');
const [showFilterSidebar, toggleFilterSidebar] = useToggle(false);
const [showFilterSidebar, toggleFilterSidebar, setShowFilterSidebar] = useToggle();
const [timelineSeries, setTimelineSeries] = useState<SeriesType[]>([]);

const handleFilterSidebarToggle = useEventCallback(() => {
if (!showFilterSidebar && !filterId) {
if (!filterId) {
dispatch(resetFilter());
navigate('filter/live');
return;
}
toggleFilterSidebar();
});

useEffect(() => {
if (!filterId && showFilterSidebar) toggleFilterSidebar();
}, [filterId, showFilterSidebar, toggleFilterSidebar]);
if (filterId === 'live') setShowFilterSidebar(true);
if (!filterId) setShowFilterSidebar(false);
}, [filterId, setShowFilterSidebar]);

const { mutate: patchSettings } = usePatchSettingsMutation();

Expand Down

0 comments on commit fd2907b

Please sign in to comment.