Signed-off-by: Michael Tighe <strideriidx@gmail.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useMemo } from 'react'
|
import React, { useCallback, useEffect, useMemo } from 'react'
|
||||||
import {
|
import {
|
||||||
BulkActionsToolbar,
|
BulkActionsToolbar,
|
||||||
ListToolbar,
|
ListToolbar,
|
||||||
@@ -84,7 +84,8 @@ const ReorderableList = ({ readOnly, children, ...rest }) => {
|
|||||||
|
|
||||||
const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
||||||
const listContext = useListContext()
|
const listContext = useListContext()
|
||||||
const { data, ids, selectedIds, onUnselectItems, refetch } = listContext
|
const { data, ids, selectedIds, onUnselectItems, refetch, setPage } =
|
||||||
|
listContext
|
||||||
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
const isDesktop = useMediaQuery((theme) => theme.breakpoints.up('md'))
|
||||||
const classes = useStyles({ isDesktop })
|
const classes = useStyles({ isDesktop })
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -93,6 +94,11 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
|||||||
const version = useVersion()
|
const version = useVersion()
|
||||||
useResourceRefresh('song', 'playlist')
|
useResourceRefresh('song', 'playlist')
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setPage(1)
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
|
}, [playlistId, setPage])
|
||||||
|
|
||||||
const onAddToPlaylist = useCallback(
|
const onAddToPlaylist = useCallback(
|
||||||
(pls) => {
|
(pls) => {
|
||||||
if (pls.id === playlistId) {
|
if (pls.id === playlistId) {
|
||||||
|
|||||||
Reference in New Issue
Block a user