@@ -272,7 +272,6 @@ export function DashAgGrid(props) {
272272 const [ openGroups , setOpenGroups ] = useState ( { } ) ;
273273 const [ columnState_push , setColumnState_push ] = useState ( true ) ;
274274 const [ rowTransactionState , setRowTransactionState ] = useState ( null ) ;
275- const [ parentState ] = useState ( props . parentState || { } ) ;
276275
277276 const components = useMemo (
278277 ( ) => ( {
@@ -1706,4 +1705,22 @@ export const defaultProps = DashAgGrid.defaultProps;
17061705var dagfuncs = ( window . dash_ag_grid = window . dash_ag_grid || { } ) ;
17071706dagfuncs . useGridFilter = useGridFilter ;
17081707
1709- export default DashAgGrid ;
1708+ const MemoizedAgGrid = React . memo ( DashAgGrid , ( prevProps , nextProps ) => {
1709+ // Check if props are equal (excluding render-specific props)
1710+ const relevantNextProps = { ...omit ( OMIT_PROP_RENDER , nextProps ) } ;
1711+ const relevantPrevProps = { ...omit ( OMIT_PROP_RENDER , prevProps ) } ;
1712+
1713+ const isInternalChange = nextProps ?. dashRenderType === 'internal' ;
1714+ const propsHaveChanged = ! equals ( relevantNextProps , relevantPrevProps ) ;
1715+ const rowDataChanged = ! equals ( nextProps . rowData , prevProps . rowData ) ;
1716+ const selectedRowsChanged = ! equals ( nextProps . selectedRows , prevProps . selectedRows ) ;
1717+
1718+ if ( propsHaveChanged && ( ! isInternalChange || rowDataChanged || selectedRowsChanged ) ) {
1719+ return false ; // Props changed, re-render
1720+ }
1721+
1722+ return true ;
1723+
1724+ } ) ;
1725+
1726+ export default MemoizedAgGrid ;
0 commit comments