fix(ui): random seed for album list on page reload (#3279)
* random seed for album list on page reload * Nit: inline variable --------- Co-authored-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -29,6 +29,7 @@ import albumLists, { defaultAlbumList } from './albumLists'
|
|||||||
import config from '../config'
|
import config from '../config'
|
||||||
import AlbumInfo from './AlbumInfo'
|
import AlbumInfo from './AlbumInfo'
|
||||||
import ExpandInfoDialog from '../dialogs/ExpandInfoDialog'
|
import ExpandInfoDialog from '../dialogs/ExpandInfoDialog'
|
||||||
|
import { useMemo } from 'react'
|
||||||
|
|
||||||
const AlbumFilter = (props) => {
|
const AlbumFilter = (props) => {
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
@@ -88,6 +89,12 @@ const AlbumList = (props) => {
|
|||||||
const refresh = useRefresh()
|
const refresh = useRefresh()
|
||||||
useResourceRefresh('album')
|
useResourceRefresh('album')
|
||||||
|
|
||||||
|
const randomStartingSeed = useMemo(() => {
|
||||||
|
return Math.random().toString()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const seed = `${randomStartingSeed}-${version}`
|
||||||
|
|
||||||
const albumListType = location.pathname
|
const albumListType = location.pathname
|
||||||
.replace(/^\/album/, '')
|
.replace(/^\/album/, '')
|
||||||
.replace(/^\//, '')
|
.replace(/^\//, '')
|
||||||
@@ -130,7 +137,7 @@ const AlbumList = (props) => {
|
|||||||
{...props}
|
{...props}
|
||||||
exporter={false}
|
exporter={false}
|
||||||
bulkActionButtons={false}
|
bulkActionButtons={false}
|
||||||
filter={{ seed: version }}
|
filter={{ seed }}
|
||||||
actions={<AlbumListActions />}
|
actions={<AlbumListActions />}
|
||||||
filters={<AlbumFilter />}
|
filters={<AlbumFilter />}
|
||||||
perPage={perPage}
|
perPage={perPage}
|
||||||
|
|||||||
Reference in New Issue
Block a user