Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGridPro] Fix the return type of useGridApiRef for Pro and Premium packages on React < 19 #16328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

arminmeh
Copy link
Contributor

Re-exported hook needs to be explicitly typed again to prevent type evaluation during build time to React.RefObject

Content of useGridApiRef.d.ts for the Pro package

before changes:

import { GridApiPro } from '../../models/gridApiPro';
export declare const useGridApiRef: () => import("react").RefObject<GridApiPro>;

after changes:

import { RefObject } from '@mui/x-internals/types';
import { GridApiCommon } from '@mui/x-data-grid';
import { GridApiPro } from '../../models/gridApiPro';
export declare const useGridApiRef: <Api extends GridApiCommon = GridApiPro>() => RefObject<Api>;

@arminmeh arminmeh added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! typescript plan: Pro Impact at least one Pro user needs cherry-pick The PR should be cherry-picked to master after merge v7.x labels Jan 24, 2025
@arminmeh arminmeh requested a review from a team January 24, 2025 15:01
@mui-bot
Copy link

mui-bot commented Jan 24, 2025

Deploy preview: https://deploy-preview-16328--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against d67b6cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! needs cherry-pick The PR should be cherry-picked to master after merge plan: Pro Impact at least one Pro user typescript v7.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants