mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-09-03 03:50:02 +03:00
Fix behavior when applying filters and switching pages (#7820)
* Fix filter handling * Make Linter happy * Make Linter happy
This commit is contained in:
@@ -42,6 +42,7 @@ const Pagination: FC<PaginationProps> = ({
|
||||
...prevState,
|
||||
StartIndex: newIndex
|
||||
}));
|
||||
window.scrollTo(0, 0);
|
||||
}, [limit, setLibraryViewSettings, startIndex]);
|
||||
|
||||
const onPreviousPageClick = useCallback(() => {
|
||||
@@ -50,6 +51,7 @@ const Pagination: FC<PaginationProps> = ({
|
||||
...prevState,
|
||||
StartIndex: newIndex
|
||||
}));
|
||||
window.scrollTo(0, 0);
|
||||
}, [limit, setLibraryViewSettings, startIndex]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -161,13 +161,6 @@ const FilterButton: FC<FilterButtonProps> = ({
|
||||
);
|
||||
};
|
||||
|
||||
const isFiltersVideoTypesEnabled = () => {
|
||||
return (
|
||||
viewType === LibraryTab.Movies
|
||||
|| viewType === LibraryTab.Episodes
|
||||
);
|
||||
};
|
||||
|
||||
const isFiltersSeriesStatusEnabled = () => {
|
||||
return viewType === LibraryTab.Series;
|
||||
};
|
||||
@@ -301,7 +294,7 @@ const FilterButton: FC<FilterButtonProps> = ({
|
||||
</Accordion>
|
||||
)}
|
||||
|
||||
{isFiltersVideoTypesEnabled() && (
|
||||
{isFiltersFeaturesEnabled() && (
|
||||
<Accordion
|
||||
expanded={expanded === 'filtersVideoTypes'}
|
||||
onChange={handleChange('filtersVideoTypes')}
|
||||
|
||||
@@ -40,6 +40,7 @@ const FiltersVideoTypes: FC<FiltersVideoTypesProps> = ({
|
||||
|
||||
setLibraryViewSettings((prevState) => ({
|
||||
...prevState,
|
||||
StartIndex: 0,
|
||||
Filters: {
|
||||
...prevState.Filters,
|
||||
VideoBasicFilter: updatedVideoBasicFilter.length ? updatedVideoBasicFilter : undefined
|
||||
|
||||
@@ -139,7 +139,7 @@ function setVisibility(context, options) {
|
||||
context.querySelector('.yearFilters').classList.remove('hide');
|
||||
}
|
||||
|
||||
if (options.mode === 'movies' || options.mode === 'episodes') {
|
||||
if (options.mode === 'movies' || options.mode === 'series' || options.mode === 'episodes') {
|
||||
context.querySelector('.videoTypeFilters').classList.remove('hide');
|
||||
}
|
||||
|
||||
|
||||
@@ -177,6 +177,7 @@ export default function (view, params, tabContent) {
|
||||
serverId: ApiClient.serverId()
|
||||
});
|
||||
Events.on(filterDialog, 'filterchange', function () {
|
||||
getQuery().StartIndex = 0;
|
||||
reloadItems(tabContent);
|
||||
});
|
||||
filterDialog.show();
|
||||
|
||||
Reference in New Issue
Block a user