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] Use a pipe processor for GridPreferencePanel children #4216

Merged
merged 6 commits into from
Mar 22, 2022

Conversation

flaviendelangle
Copy link
Member

Extracted from #4208

If we want to add a preference panel from a pro / premium feature, we are currently stuck.
Maybe we need to change the whole approach of the preference panel at some point, but this PRs should not introduce any breaking change.

@flaviendelangle flaviendelangle added core Infrastructure work going on behind the scenes component: data grid This is the name of the generic UI component, not the React module! labels Mar 17, 2022
@flaviendelangle flaviendelangle self-assigned this Mar 17, 2022
@flaviendelangle flaviendelangle changed the title [core] Use a pipe processor for GridPreferencePanel children [core] Use a pipe processor for GridPreferencePanel children Mar 17, 2022
@mui-bot
Copy link

mui-bot commented Mar 17, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 254.2 492.6 320.3 348.56 91.07
Sort 100k rows ms 458.5 843.7 619.1 640.7 125.944
Select 100k rows ms 95.7 207.7 186.4 153.1 40.649
Deselect 100k rows ms 115.3 212.2 167.9 164.4 31.695

Generated by 🚫 dangerJS against 3c247b3

@github-actions
Copy link

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

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 18, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Mar 18, 2022
Comment on lines 25 to 32
{...rootProps.componentsProps?.basePopper}
>
{!rootProps.disableColumnSelector && isColumnsTabOpen && (
<rootProps.components.ColumnsPanel {...rootProps.componentsProps?.columnsPanel} />
)}

{!rootProps.disableColumnFilter && isFiltersTabOpen && (
<rootProps.components.FilterPanel {...rootProps.componentsProps?.filterPanel} />
{apiRef.current.unstable_applyPreProcessors(
'preferencePanel',
null,
preferencePanelState.openedPanelValue ?? GridPreferencePanelsValue.filters,
)}
</rootProps.components.Panel>
Copy link
Member

Choose a reason for hiding this comment

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

That's a bit weird to see apiRef.current.unstable_applyPreProcessors called inside the rendering

Could be more readable as follow, but not 100% sure it's the same

const panelContent = apiRef.current.unstable_applyPreProcessors(...);
...
<rootProps.components.Panel ...>
	{panelContent}
</rootProps.components.Panel>

Copy link
Member Author

Choose a reason for hiding this comment

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

It is the same yes
Done

Copy link
Member

Choose a reason for hiding this comment

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

Are you lucky-luke? ;)

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.

LGTM

I was a bit confused with applyPreprocessors. From the name I thought it was kind of a reducer which applies all preprocess methods on state data. I did not realise it could also return a value

@flaviendelangle
Copy link
Member Author

I was a bit confused with applyPreprocessors. From the name I thought it was kind of a reducer which applies all preprocess methods on state data. I did not realise it could also return a value

I plan to rename all this pre-processing code to pipe processing
The pattern is indeed basically a reducer.

@flaviendelangle flaviendelangle merged commit 95c894f into mui:master Mar 22, 2022
@flaviendelangle flaviendelangle deleted the preference-panel branch March 22, 2022 07:58
alexfauquette pushed a commit to alexfauquette/mui-x that referenced this pull request Aug 26, 2022
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants