From ae66eb835ab015484f96d0875d533feb77d5ce44 Mon Sep 17 00:00:00 2001 From: euvre <93761161+euvre@users.noreply.github.com> Date: Wed, 5 Aug 2026 22:53:42 -0700 Subject: [PATCH] fix(web): file list total count doesn't match displayed rows (#17747) --- web/src/pages/files/files-table.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/web/src/pages/files/files-table.tsx b/web/src/pages/files/files-table.tsx index 3f565c7e59..f25c814155 100644 --- a/web/src/pages/files/files-table.tsx +++ b/web/src/pages/files/files-table.tsx @@ -114,8 +114,8 @@ export function FilesTable({ // Sort files with skills folder first, then by time // Filter out skills folder if not in hybrid/go mode - const sortedFiles = useMemo(() => { - if (!files) return []; + const { sortedFiles, hiddenCount } = useMemo(() => { + if (!files) return { sortedFiles: [] as IFile[], hiddenCount: 0 }; // Filter out skills folder if feature is disabled const filteredFiles = isSkillsEnabled @@ -126,7 +126,7 @@ export function FilesTable({ return !isSkills; }); - return [...filteredFiles].sort((a, b) => { + const sorted = [...filteredFiles].sort((a, b) => { const aIsSkills = isFolderType(a.type) && a.name.toLowerCase() === 'skills'; const bIsSkills = @@ -139,8 +139,15 @@ export function FilesTable({ // Then sort by create_time desc (newest first) return (b.create_time || 0) - (a.create_time || 0); }); + + return { sortedFiles: sorted, hiddenCount: files.length - filteredFiles.length }; }, [files, isSkillsEnabled]); + // Keep the displayed total consistent with the rows actually shown: + // client-side filtered rows (e.g. the skills folder when the feature is + // disabled) are still included in the server-side total. + const displayTotal = Math.max((total ?? 0) - hiddenCount, 0); + const columns: ColumnDef[] = [ { id: 'select', @@ -329,7 +336,7 @@ export function FilesTable({ rowSelection, pagination: currentPagination, }, - rowCount: total ?? 0, + rowCount: displayTotal, debugTable: true, }); @@ -393,7 +400,7 @@ export function FilesTable({