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] Make @mui/x-data-grid-pro import shared code from @mui/x-data-grid #3688

Merged
merged 148 commits into from
Feb 15, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 21, 2022

Part of #924
Fix #2245

Codesandbox playground for DataGridPro

Note: The proptypes generation is broken for pro-only components. Will be fixed in #3953.

In this PR

  • Move almost all the pro-only code into packages/grid/x-data-grid-pro/src

  • Import the shared code from @mui/x-data-grid instead of packages/grid/_modules_

This code should not be released as is, we should drop the whole _modules_ folder before to avoid problems.

What's next ?

  • Move all the community code into packages/grid/x-data-grid/src and drop packages/grid/_modules_/

  • Migrate @mui/x-data-grid, @mui/x-data-grid-pro and @mui/x-data-grid-generator to the core bundling strategy (see [core] Migrate @mui/x-license-pro to the new bundling strategy #3738)

  • In @mui/x-data-grid-pro, replace the imports from the the root of @mui/x-data-grid prefixed with unstable with imports from @mui/x-data-grid/internals/xxx

  • Stop listing the pro-only events in GridEvents (we will probably need to replace the enum with type GridEvents = keyof GridEventLookup, which is a breaking change) - Need v6

  • Stop listing the pro-only components in GridSlotsComponent

@mui-bot
Copy link

mui-bot commented Jan 21, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 210.8 369.7 246.9 275.2 58.612
Sort 100k rows ms 381.5 887.5 614.3 620.06 161.242
Select 100k rows ms 182.7 303.2 257.4 245.62 40.66
Deselect 100k rows ms 137.6 283.5 204.8 197.28 53.083

Generated by 🚫 dangerJS against b6fc731

@flaviendelangle flaviendelangle marked this pull request as ready for review February 14, 2022 09:40
@flaviendelangle flaviendelangle added component: data grid This is the name of the generic UI component, not the React module! core Infrastructure work going on behind the scenes plan: Pro Impact at least one Pro user labels Feb 14, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 14, 2022
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Feb 15, 2022
Copy link
Member

@m4theushw m4theushw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll do a more detailed review once #3953 is ready. With the _modules_ folder it's complicated to see the impact of this PR.

@@ -115,18 +119,17 @@
{ "name": "GridColumnMenuState", "kind": "Interface" },
{ "name": "GridColumnOrderChangeParams", "kind": "Interface" },
{ "name": "GridColumnPinningApi", "kind": "Interface" },
{ "name": "GridColumnPinningMenuItems", "kind": "ExportSpecifier" },
Copy link
Member

@m4theushw m4theushw Feb 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be exported to avoid a breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I'll do a double check on the export files

import { GridColDef } from '../../../models/colDef/gridColDef';
import { GridPinnedPosition } from '../../../models/api/gridColumnPinningApi';
import { GridApiPro } from '../../../models/api/gridApiPro';
import { GridColDef } from '@mui/x-data-grid';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we would have a Pro GridColDef, instead of using module augmentation.

As example:

Suggested change
import { GridColDef } from '@mui/x-data-grid';
import { GridColDef } from '../../../gridColDef';

But we can see how this approach works in the long term.

Copy link
Member Author

@flaviendelangle flaviendelangle Feb 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a pro GridColDef at one point
But it was creating too many problems with the api params deep inside some GridColDef callbacks.
So I went for the easy way for now.

@flaviendelangle
Copy link
Member Author

@m4theushw for you deep review, I propose to do it on the new bundling strategy PR (after #3953)
At that point, @mui/x-data-grid-pro should not export the DataGrid component for instance.
So comparing export snapshots between the last release and this PR should give you a clearer vision of what has been added or removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! core Infrastructure work going on behind the scenes plan: Pro Impact at least one Pro user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[DataGridPro] Cannot use component from @mui/x-data-grid in a @mui/x-data-grid-pro
6 participants