From 11bd5f30ffbb4b353992f45cd30d74cb687e0fae Mon Sep 17 00:00:00 2001 From: jeffvli Date: Tue, 7 Dec 2021 16:40:53 -0800 Subject: [PATCH] Reset scroll positions on genre link --- src/components/library/AlbumList.tsx | 1 + src/components/library/AlbumView.tsx | 4 ++++ src/components/library/GenreList.tsx | 2 ++ src/components/viewtypes/ListViewTable.tsx | 2 ++ 4 files changed, 9 insertions(+) diff --git a/src/components/library/AlbumList.tsx b/src/components/library/AlbumList.tsx index cfc26a1..3bf7055 100644 --- a/src/components/library/AlbumList.tsx +++ b/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} diff --git a/src/components/library/AlbumView.tsx b/src/components/library/AlbumView.tsx index bc3f56f..51dda67 100644 --- a/src/components/library/AlbumView.tsx +++ b/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); diff --git a/src/components/library/GenreList.tsx b/src/components/library/GenreList.tsx index 6f6ee97..02bdadf 100644 --- a/src/components/library/GenreList.tsx +++ b/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 diff --git a/src/components/viewtypes/ListViewTable.tsx b/src/components/viewtypes/ListViewTable.tsx index bbc44bd..a1903fb 100644 --- a/src/components/viewtypes/ListViewTable.tsx +++ b/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);