diff --git a/ui/src/album/AlbumList.jsx b/ui/src/album/AlbumList.jsx index 011026ab3..d9c7d1066 100644 --- a/ui/src/album/AlbumList.jsx +++ b/ui/src/album/AlbumList.jsx @@ -18,7 +18,6 @@ import { import FavoriteIcon from '@material-ui/icons/Favorite' import { withWidth } from '@material-ui/core' import { - InfinitePagination, InfiniteScrollWrapper, List, QuickFilter, @@ -241,7 +240,7 @@ const AlbumList = (props) => { perPage={perPage} pagination={ infiniteScrollEnabled ? ( - + false ) : ( ) diff --git a/ui/src/common/InfinitePagination.jsx b/ui/src/common/InfinitePagination.jsx deleted file mode 100644 index 342d8148d..000000000 --- a/ui/src/common/InfinitePagination.jsx +++ /dev/null @@ -1 +0,0 @@ -export const InfinitePagination = () => null diff --git a/ui/src/common/index.js b/ui/src/common/index.js index b62aea2b5..690fb76b9 100644 --- a/ui/src/common/index.js +++ b/ui/src/common/index.js @@ -42,5 +42,4 @@ export * from './playlistUtils.js' export * from './PathField.jsx' export * from './ParticipantsInfo' export * from './useInfiniteScroll.jsx' -export * from './InfinitePagination' export * from './InfiniteScrollWrapper' diff --git a/ui/src/common/useInfiniteScroll.jsx b/ui/src/common/useInfiniteScroll.jsx index a9ecf4f41..081514da2 100644 --- a/ui/src/common/useInfiniteScroll.jsx +++ b/ui/src/common/useInfiniteScroll.jsx @@ -12,32 +12,26 @@ import { useHistory, useLocation } from 'react-router-dom' const InfiniteScrollContext = createContext(null) +const scrollStateCache = new Map() + const getStorageKey = (pathname, filterValues) => { const filterKey = JSON.stringify(filterValues || {}) - return `infiniteScroll:${pathname}:${filterKey}` + return `${pathname}:${filterKey}` } const saveScrollState = (pathname, filterValues, pagesLoaded, scrollY) => { const key = getStorageKey(pathname, filterValues) - sessionStorage.setItem(key, JSON.stringify({ pagesLoaded, scrollY })) + scrollStateCache.set(key, { pagesLoaded, scrollY }) } const getScrollState = (pathname, filterValues) => { const key = getStorageKey(pathname, filterValues) - const saved = sessionStorage.getItem(key) - if (saved) { - try { - return JSON.parse(saved) - } catch { - return null - } - } - return null + return scrollStateCache.get(key) || null } const clearScrollState = (pathname, filterValues) => { const key = getStorageKey(pathname, filterValues) - sessionStorage.removeItem(key) + scrollStateCache.delete(key) } export const InfiniteScrollProvider = ({ children }) => {