Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix flickering document count and total when toggling file filter on search page (#17161)

euvref2a48df56b22
diff --git a/web/src/hooks/use-knowledge-request.ts b/web/src/hooks/use-knowledge-request.ts
index 5b58a258fb..e88c7828bb 100644
--- a/web/src/hooks/use-knowledge-request.ts
+++ b/web/src/hooks/use-knowledge-request.ts
@@ -1075,7 +1075,7 @@ export const useSelectTestingResult = (): ITestingResult => {
return mutation.state.data;
},
});
- return (data.at(-1) ?? {
+ return (data.filter((x) => x !== undefined).at(-1) ?? {
chunks: [],
documents: [],
total: 0,
@@ -1109,7 +1109,7 @@ export const useAllTestingResult = (): ITestingResult => {
return mutation.state.data;
},
});
- return (data.at(-1) ?? {
+ return (data.filter((x) => x !== undefined).at(-1) ?? {
chunks: [],
documents: [],
total: 0,
diff --git a/web/src/pages/next-search/hooks.ts b/web/src/pages/next-search/hooks.ts
index 33c86716a9..61e023000d 100644
--- a/web/src/pages/next-search/hooks.ts
+++ b/web/src/pages/next-search/hooks.ts
@@ -149,7 +149,6 @@ export const useTestChunkRetrieval = (
mutateAsync,
} = useMutation({
mutationKey: ['testChunk'], // This method is invalid
- gcTime: 0,
mutationFn: async (values: any) => {
const { data } = await retrievalTestFunc({
page,
@@ -200,7 +199,6 @@ export const useTestChunkAllRetrieval = (
mutateAsync,
} = useMutation({
mutationKey: ['testChunkAll'], // This method is invalid
- gcTime: 0,
mutationFn: async (values: any) => {
const { data } = await retrievalTestFunc({
page,