The minimalistic document archiving platform.
fix(documents): reset global selection on row change (#1420)
Quentin Marlats510c162b241c
diff --git a/.changeset/hungry-planets-smell.md b/.changeset/hungry-planets-smell.mdnew file mode 100644index 00000000..c6812efd--- /dev/null+++ b/.changeset/hungry-planets-smell.md@@ -0,0 +1,5 @@+---+'@papra/app': patch+---++Fixed the batch document selection remaining in "select all matching documents" mode after unselecting documents.diff --git a/apps/papra-client/src/modules/documents/pages/documents.page.tsx b/apps/papra-client/src/modules/documents/pages/documents.page.tsxindex a568072b..1ff39ad6 100644--- a/apps/papra-client/src/modules/documents/pages/documents.page.tsx+++ b/apps/papra-client/src/modules/documents/pages/documents.page.tsx@@ -45,7 +45,7 @@ export const DocumentsPage: Component = () => {});const debouncedSearchQuery = useDebounce(getSearchQuery, 300);const [getPagination, setPagination] = createParamSynchronizedPagination();- const [getRowSelection, setRowSelection] = createSignal<RowSelectionState>({});+ const [getRowSelection, setInternalRowSelection] = createSignal<RowSelectionState>({});const [getSelectAllMatchingQuery, setSelectAllMatchingQuery] = createSignal(false);const [getTagDialogOpen, setTagDialogOpen] = createSignal(false);@@ -102,6 +102,11 @@ export const DocumentsPage: Component = () => {placeholderData: keepPreviousData,}));+ const setRowSelection: Setter<RowSelectionState> = (valueOrUpdater) => {+ setSelectAllMatchingQuery(false);+ return setInternalRowSelection(valueOrUpdater);+ };+const getSelectedIds = createMemo(() => {const selection = getRowSelection();return Object.keys(selection).filter((id) => selection[id]);