Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/hooks/use-data-grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1932,8 +1932,10 @@ function useDataGrid<TData>({
store.setState("focusedCell", null);
store.setState("editingCell", null);
});

propsRef.current.onRowSelectionChange?.(updater);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onRowSelectionChange here calls the user prop with updater, but the surrounding handlers (onSortingChange / onColumnFiltersChange) pass the resolved next state value. Since this function already computes newRowSelection, consider invoking propsRef.current.onRowSelectionChange with newRowSelection to match the established pattern and avoid parent state updates diverging if the parent applies a functional updater against a different previous selection state.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces a new external behavior (calling propsRef.current.onRowSelectionChange from the internal handler) but there isn't a corresponding test (unlike sorting/filtering callbacks). Add a unit test that triggers a row selection change and asserts the callback is called with the expected argument shape/value so regressions are caught.

Suggested change
propsRef.current.onRowSelectionChange?.(updater);
propsRef.current.onRowSelectionChange?.(newRowSelection);

Copilot uses AI. Check for mistakes.
},
[store, columnIds],
[store, columnIds, propsRef],
);

const onRowSelect = React.useCallback(
Expand Down