diff --git a/packages/grid/x-data-grid/src/hooks/core/useGridApiInitialization.ts b/packages/grid/x-data-grid/src/hooks/core/useGridApiInitialization.ts index f1174749d1bf..e73bf0584789 100644 --- a/packages/grid/x-data-grid/src/hooks/core/useGridApiInitialization.ts +++ b/packages/grid/x-data-grid/src/hooks/core/useGridApiInitialization.ts @@ -141,6 +141,10 @@ export function useGridApiInitialization< useGridApiMethod(privateApiRef, { subscribeEvent, publishEvent } as any, 'public'); + if (inputApiRef && !inputApiRef.current?.state) { + inputApiRef.current = publicApiRef.current; + } + React.useImperativeHandle(inputApiRef, () => publicApiRef.current, [publicApiRef]); React.useEffect(() => { diff --git a/packages/grid/x-data-grid/src/tests/rows.DataGrid.test.tsx b/packages/grid/x-data-grid/src/tests/rows.DataGrid.test.tsx index c76a431b1ef4..3dcb768db66e 100644 --- a/packages/grid/x-data-grid/src/tests/rows.DataGrid.test.tsx +++ b/packages/grid/x-data-grid/src/tests/rows.DataGrid.test.tsx @@ -31,6 +31,7 @@ import { getRow, getActiveCell, getCell, + microtasks, } from 'test/utils/helperFn'; import Dialog from '@mui/material/Dialog'; @@ -311,6 +312,7 @@ describe(' - Rows', () => { await waitFor(() => { expect(getRow(0)).not.to.have.class('Mui-selected'); }); + await microtasks(); }); it('should not select the row when opening the menu', async () => {