You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#500 (fix/429) resets `currentPage` to 1 when `path` or `query` changes in `FileManagerTable.jsx`, mirroring the precedent set in `AudioFileBrowser` (#427). That covers directory navigation and filter changes, but it leaves one bug class open: the current page can point past the last page when `content` itself shrinks without `path` or `query` changing.
Repro
Filter to ~11 matches so pagination shows 2 pages.
That covers path/query/delete/upload uniformly without relying on the effect's dependency list staying in sync with every state that can affect list length.
Scope
Apply the clamp in `web/src/components/file-manager/FileManagerTable.jsx`.
Regression tests: delete-last-row-on-last-page for `FileManager` (and audio equivalent if we touch it), assert that the visible page falls back to a valid one.
Context
#500 (fix/429) resets `currentPage` to 1 when `path` or `query` changes in `FileManagerTable.jsx`, mirroring the precedent set in `AudioFileBrowser` (#427). That covers directory navigation and filter changes, but it leaves one bug class open: the current page can point past the last page when `content` itself shrinks without `path` or `query` changing.
Repro
Upload-shrinks-page-count is theoretically the same shape but less likely in practice.
Proposed fix
Rather than enumerating every trigger that can shrink the list, clamp at render:
```js
const totalPages = Math.max(1, Math.ceil(sortedContent.length / filesPerPage));
const effectivePage = Math.min(currentPage, totalPages);
```
That covers path/query/delete/upload uniformly without relying on the effect's dependency list staying in sync with every state that can affect list length.
Scope
Notes