Skip to content

Commit

Permalink
Move first render marked in an effect
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi committed Oct 11, 2024
1 parent 3e1a1fd commit 532a1bf
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ export const useGridRowSelection = (
const removeOutdatedSelection = React.useCallback(
(sortModelUpdated = false) => {
if (isFirstRender.current) {
isFirstRender.current = false;
return;
}
const currentSelection = gridRowSelectionStateSelector(apiRef.current.state);
Expand Down Expand Up @@ -762,4 +761,10 @@ export const useGridRowSelection = (
React.useEffect(() => {
runIfRowSelectionIsEnabled(removeOutdatedSelection);
}, [removeOutdatedSelection, runIfRowSelectionIsEnabled]);

React.useEffect(() => {
if (isFirstRender.current) {
isFirstRender.current = false;
}
}, []);
};

0 comments on commit 532a1bf

Please sign in to comment.