Repository navigation
v4.0.0
[v4.0.0] - 2025-09-12
🚨 BREAKING CHANGES
- Function Signatures Updated: The
onRowSelectcallback now receives optional second and third parameters:clearSelectionsAfterAction?: () => void, revalidate?: () => void - Bulk Action Signatures Updated: All
BulkActiononClick handlers now receive optional second and third parameters:clearSelectionsAfterAction?: () => void, revalidate?: () => void
Added
- Selection Alert Feature: New
showSelectionAlertprop to display selection count when any items are selected (instead of only when all items are selected) - Keep Selected Option: New
showKeepSelectedOptionprop to show a checkbox allowing users to keep selections after bulk actions - Data Revalidation Support: Added
revalidatefunction to callbacks, enabling data refresh without component re-mounting - Enhanced Bulk Actions: Bulk actions now receive
clearSelectionsAfterActionandrevalidatefunctions for better control over selection state and data freshness
Changed
- CSS Variables: Updated hardcoded colors in checkbox inputs to use consistent CSS variable theming system
- Selection Persistence: Improved selection state management to work better with data revalidation
Migration Guide
Breaking Changes
-
onRowSelect callback (optional parameters added):
// Before onRowSelect?: (selectedIds: string[]) => void; // After onRowSelect?: ( selectedIds: string[], clearSelectionsAfterAction?: () => void, revalidate?: () => void ) => void;
-
BulkAction onClick handlers (optional parameters added):
// Before onClick: (selectedIds: string[]) => void; // After onClick: ( selectedIds: string[], clearSelectionsAfterAction?: () => void, revalidate?: () => void ) => void;
Recommended Migration (for new features)
To use the new "keep selected" functionality, replace component re-mounting patterns with the new revalidate function:
// Current approach (still works, but prevents "keep selected" from working)
const [refreshKey, setRefreshKey] = useState(0);
<DataTable key={refreshKey} {...props} />// Recommended approach (enables "keep selected" functionality)
<DataTable
bulkActions={[
{
key: "delete",
label: "Delete Selected",
onClick: (
selectedIds: string[],
clearSelectionsAfterAction?: () => void,
revalidate?: () => void
) => {
performBulkAction(selectedIds).then(() => {
revalidate?.(); // Refresh data without losing selections
clearSelectionsAfterAction?.(); // Conditionally clear based on user preference
});
},
},
]}
showSelectionAlert
showKeepSelectedOption
{...otherProps}
/>