Files
navidrome/ui/src/common/Pagination.jsx
T
Deluan 3bc09f9d03 feat(ui): abort all in-flight image fetches on pagination change
Pagination component now watches page/perPage via useListContext and
calls abortAllInFlight() when either changes, freeing the browser
connection pool immediately for the next page's data request.

Also adds empty placeholder style to CoverArtAvatar so it renders as a
clean transparent area while loading instead of the default person icon.
2026-03-25 19:58:49 -04:00

19 lines
581 B
React

import React, { useEffect, useRef } from 'react'
import { Pagination as RAPagination, useListContext } from 'react-admin'
import { abortAllInFlight } from './useImageUrl'
export const Pagination = (props) => {
const { page, perPage } = useListContext()
const prevRef = useRef({ page, perPage })
useEffect(() => {
const prev = prevRef.current
if (prev.page !== page || prev.perPage !== perPage) {
abortAllInFlight()
prevRef.current = { page, perPage }
}
}, [page, perPage])
return <RAPagination rowsPerPageOptions={[15, 25, 50]} {...props} />
}