RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
fix: row selection leaks across pages in dataset and file list tables (#13668)
Zhicheng Wu456b1bbf6666
diff --git a/web/src/hooks/logic-hooks/use-row-selection.ts b/web/src/hooks/logic-hooks/use-row-selection.tsindex e86fc9bb0c..af6cf37b5f 100644--- a/web/src/hooks/logic-hooks/use-row-selection.ts+++ b/web/src/hooks/logic-hooks/use-row-selection.ts@@ -29,10 +29,21 @@ export function useSelectedIds<T extends Array<{ id: string }>>(list: T,) {const selectedIds = useMemo(() => {- const indexes = Object.keys(rowSelection);- return list- .filter((x, idx) => indexes.some((y) => Number(y) === idx))- .map((x) => x.id);+ // When using getRowId, rowSelection keys are IDs, not indices+ const selectionKeys = Object.keys(rowSelection);++ // Check if keys are numeric (index-based) or string IDs+ const isIndexBased = selectionKeys.every((key) => !isNaN(Number(key)));++ if (isIndexBased) {+ // Legacy index-based selection+ return list+ .filter((x, idx) => selectionKeys.some((y) => Number(y) === idx))+ .map((x) => x.id);+ } else {+ // ID-based selection (when getRowId is used)+ return selectionKeys.filter((id) => list.some((item) => item.id === id));+ }}, [list, rowSelection]);return { selectedIds };diff --git a/web/src/pages/dataset/dataset/dataset-table.tsx b/web/src/pages/dataset/dataset/dataset-table.tsxindex 1cf29aadb8..950aa76727 100644--- a/web/src/pages/dataset/dataset/dataset-table.tsx+++ b/web/src/pages/dataset/dataset/dataset-table.tsx@@ -114,6 +114,7 @@ export function DatasetTable({getFilteredRowModel: getFilteredRowModel(),onColumnVisibilityChange: setColumnVisibility,onRowSelectionChange: setRowSelection,+ getRowId: (row) => row.id, // Use document ID instead of row indexmanualPagination: true, //we're doing manual "server-side" paginationstate: {sorting,diff --git a/web/src/pages/files/files-table.tsx b/web/src/pages/files/files-table.tsxindex abc072185e..4c6f9d3a3b 100644--- a/web/src/pages/files/files-table.tsx+++ b/web/src/pages/files/files-table.tsx@@ -260,7 +260,7 @@ export function FilesTable({getFilteredRowModel: getFilteredRowModel(),onColumnVisibilityChange: setColumnVisibility,onRowSelectionChange: setRowSelection,-+ getRowId: (row) => row.id, // Use file ID instead of row indexmanualPagination: true, //we're doing manual "server-side" paginationenableRowSelection(row) {return !isKnowledgeBaseType(row.original.source_type);