Просмотр исходного кода

fix(dashboard): Hide bulk action bar when no selected items are visible (#4151)

Jan Tokic 1 день назад
Родитель
Сommit
d1a514bd32

+ 2 - 1
packages/dashboard/src/lib/components/data-table/data-table-bulk-actions.tsx

@@ -27,6 +27,7 @@ export function DataTableBulkActions<TData>({
     // Cache to store selected items across page changes
     const selectedItemsCache = useRef<Map<string, TData>>(new Map());
     const selectedRowIds = Object.keys(table.getState().rowSelection);
+    const visibleSelectedCount = table.getRowModel().rows.filter(row => row.getIsSelected()).length;
 
     // Get selection from cache instead of trying to get from table
     const selection = selectedRowIds
@@ -49,7 +50,7 @@ export function DataTableBulkActions<TData>({
         .filter((item): item is TData => item !== undefined);
 
     const { position, shouldShow } = useFloatingBulkActions({
-        selectionCount: selection.length,
+        selectionCount: visibleSelectedCount,
         containerSelector: '[data-table-root], .data-table-container, table',
         bottomOffset: 40,
     });