mirror of
https://github.com/projectsend/projectsend.git
synced 2026-12-06 18:59:38 +00:00
Keep the open folder when sorting the staff library
Clicking Name, Size or Uploaded inside a folder went back to the top of the library: the list's query helper never carried the folder, so every sort or page-size change navigated without it. My files had the same bug and was already fixed by passing the folder as a route parameter. The staff library now does the same. Searching and filtering still show a flat list across the library, because the server ignores the folder while one is set. Checked in headless Chrome: sorting by name in folder 1 went to ?direction=asc&sort=name before, and ?direction=asc&folder=1&sort=name now. Reported by @lumenzzz (#1844)
This commit is contained in:
@@ -235,11 +235,13 @@ export default function FilesIndex({
|
||||
onSuccess: () => clearSelection(),
|
||||
});
|
||||
|
||||
// A search term or a category filter both switch to a flat, global view,
|
||||
// dropping the current folder context.
|
||||
// A search term or a category filter both switch to a flat, global view;
|
||||
// the server ignores the folder while one is set.
|
||||
// `sort`, `direction` and `per_page` ride along so a new filter keeps
|
||||
// them. Reset leaves them alone too: they are how the list is shown,
|
||||
// not what is in it.
|
||||
// The open folder goes along with every change, as in My files, or
|
||||
// sorting inside a folder went back to the top of the library (#1844).
|
||||
const perPage = pagination.per_page !== undefined && pagination.per_page !== pagination.per_page_options?.[0] ? String(pagination.per_page) : '';
|
||||
const { values, set, setMany, reset } = useListQuery(
|
||||
'files.index',
|
||||
@@ -269,6 +271,7 @@ export default function FilesIndex({
|
||||
version: ALL,
|
||||
expired: '',
|
||||
},
|
||||
folder !== null ? { folder: folder.id } : undefined,
|
||||
);
|
||||
const sortBy = (column: string, nextDirection: SortDirection) => setMany({ sort: column, direction: nextDirection });
|
||||
// The Clear button is for what narrows the list, not how it is shown.
|
||||
|
||||
Reference in New Issue
Block a user