Browse Source

Reset scroll positions on genre link

master
jeffvli 3 years ago
parent
commit
11bd5f30ff
  1. 1
      src/components/library/AlbumList.tsx
  2. 4
      src/components/library/AlbumView.tsx
  3. 2
      src/components/library/GenreList.tsx
  4. 2
      src/components/viewtypes/ListViewTable.tsx

1
src/components/library/AlbumList.tsx

@ -222,6 +222,7 @@ const AlbumList = () => {
size="sm"
width={180}
defaultValue={album.active.filter}
value={album.active.filter}
groupBy="role"
data={sortTypes}
cleanable={false}

4
src/components/library/AlbumView.tsx

@ -375,6 +375,8 @@ const AlbumView = ({ ...rest }: any) => {
onClick={() => {
if (!rest.isModal) {
dispatch(setActive({ ...album.active, filter: d.title }));
localStorage.setItem('scroll_list_albumList', '0');
localStorage.setItem('scroll_grid_albumList', '0');
setTimeout(() => {
history.push(`/library/album?sortType=${d.title}`);
}, 50);
@ -385,6 +387,8 @@ const AlbumView = ({ ...rest }: any) => {
e.preventDefault();
if (!rest.isModal) {
dispatch(setActive({ ...album.active, filter: d.title }));
localStorage.setItem('scroll_list_albumList', '0');
localStorage.setItem('scroll_grid_albumList', '0');
setTimeout(() => {
history.push(`/library/album?sortType=${d.title}`);
}, 50);

2
src/components/library/GenreList.tsx

@ -54,6 +54,8 @@ const GenreList = () => {
window.clearTimeout(timeout);
timeout = null;
dispatch(setActive({ ...album.active, filter: rowData.title }));
localStorage.setItem('scroll_list_albumList', '0');
localStorage.setItem('scroll_grid_albumList', '0');
dispatch(clearSelected());
// Needs a small delay or the filter won't set properly when navigating to the album list

2
src/components/viewtypes/ListViewTable.tsx

@ -949,6 +949,8 @@ const ListViewTable = ({
filter: genre.title,
})
);
localStorage.setItem('scroll_list_albumList', '0');
localStorage.setItem('scroll_grid_albumList', '0');
setTimeout(() => {
history.push(`/library/album?sortType=${genre.title}`);
}, 50);

Loading…
Cancel
Save