[data grid] DataGrid gives warning about apiRef.current #15507
Labels
component: data grid
This is the name of the generic UI component, not the React module!
customization: extend
Logic customizability
status: waiting for maintainer
These issues haven't been looked at yet by a maintainer
support: commercial
Support request from paid users
support: pro standard
Support request from a Pro standard plan user. https://mui.com/legal/technical-support-sla/
The problem in depth
I am using DataGridPro in Dialog. When the dialog is opened for a second time, the following warning is printed to console:
"Warning: Failed prop type: The prop
apiRef.current
is marked as required inForwardRef(DataGridPro)
, but its value isnull
."Here is a simplified demo that demonstrates the issue. I also made a code sandbox demo.
I have a parent component for controlling when the dialog is open/closed.
And a child component for the actual dialog and DataGrid:
Please explain why the apiRef becomes null briefly when the dialog is reopened and causes the warning. The functionality seems fine though, but I would like to get rid of the warning (and also understand the reason for it). Thanks!
Your environment
System:
OS: Windows 11 10.0.22631
Binaries:
Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
pnpm: Not Found
Browsers:
Chrome: Not Found
Edge: Chromium (127.0.2651.86)
npmPackages:
@emotion/react: ^11.11.4 => 11.11.4
@emotion/styled: ^11.11.5 => 11.11.5
@mui/base: 5.0.0-beta.40
@mui/core-downloads-tracker: 5.15.20
@mui/icons-material: ^5.15.20 => 5.15.20
@mui/material: ^5.15.20 => 5.15.20
@mui/private-theming: 5.15.20
@mui/styled-engine: 5.15.14
@mui/system: 5.15.20
@mui/types: 7.2.16
@mui/utils: 5.16.6
@mui/x-data-grid: ^7.6.2 => 7.22.2
@mui/x-data-grid-pro: ^7.22.2 => 7.22.2
@mui/x-date-pickers: ^7.16.0 => 7.16.0
@mui/x-internals: 7.16.0
@mui/x-license: 7.21.0
@types/react: ^18.2.66 => 18.3.3
react: ^18.2.0 => 18.3.1
react-dom: ^18.2.0 => 18.3.1
typescript: ^5.2.2 => 5.4.5
problem is reproduced on both Edge and Chrome
Search keywords: apiRef.current
Order ID: 98745
The text was updated successfully, but these errors were encountered: