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

[core] Stop using an enum for GridPreProcessingGroup #3798

Merged
merged 3 commits into from Feb 1, 2022

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jan 31, 2022

Extracted from #3688

100% core, no impact for users.

Enums can't be extended between the community and the pro package.
For the pre-processing I reverted the logic by generating the type as the keys of the lookup.
Maybe the GridEvents could also be a type instead of an enum in v6.

@flaviendelangle flaviendelangle self-assigned this Jan 31, 2022
@flaviendelangle flaviendelangle added the core Infrastructure work going on behind the scenes label Jan 31, 2022
@mui-bot
Copy link

mui-bot commented Jan 31, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 1,498.9 2,716.1 1,717.4 2,040.46 506.317
Sort 100k rows ms 966.6 1,594 1,562.3 1,377.76 237.745
Select 100k rows ms 241.3 306.4 284.3 278.38 21.777
Deselect 100k rows ms 156.6 380.1 195.1 229.28 78.874

Generated by 🚫 dangerJS against 4425b38

@flaviendelangle flaviendelangle changed the title [core] Stop using an enum for GridPreProcessingGroup [core] Stop using an enum for GridPreProcessingGroup Jan 31, 2022
Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

I'm not that much familiar with typescript. That's what I understand:

The GridPreProcessingGroup enum can not be extended which is a problem to add for example row grouping.

So instead, you use keyof GridPreProcessingGroupLookup which is equivalent to
'hydrateColumns' | 'scrollToIndexes' | ...

This type is used for the unstable_applyPreProcessors to indicate to which group the preprocessor must be applied

If yes, its good for me

@flaviendelangle
Copy link
Member Author

flaviendelangle commented Feb 1, 2022

@alexfauquette Exactly, and it is also used to type directly the callbacks

  const updateSelectionColumn = React.useCallback<
    GridPreProcessor<GridPreProcessingGroup.hydrateColumns>
  >()

Becomes

  const updateSelectionColumn = React.useCallback<GridPreProcessor<"hydrateColumns">>()

@flaviendelangle flaviendelangle merged commit cbe570c into mui:master Feb 1, 2022
@flaviendelangle flaviendelangle deleted the pre-processor-enum branch February 1, 2022 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants