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

[data grid] Remove GridEvents enum #4684

Closed
4 tasks done
Tracked by #3287
flaviendelangle opened this issue Apr 28, 2022 · 0 comments · Fixed by #6003
Closed
4 tasks done
Tracked by #3287

[data grid] Remove GridEvents enum #4684

flaviendelangle opened this issue Apr 28, 2022 · 0 comments · Fixed by #6003
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! v6.x

Comments

@flaviendelangle
Copy link
Member

flaviendelangle commented Apr 28, 2022

I v6, I propose we drop the GridEvents enum in favor of a simple type generated from the keys of GridEventLookup (the actual GridEventsStr.

That way, we will not have to define the pro-only and premium-only events inside the gridEvents.ts file which is located in the community package.
Just like for pre-processor, there is no reference to pro-only processors inside the community package because they are based on the lookup which is augmented in the pro and premium packages.

-apiRef.current.subscribeEvent(GridEvents.rowGroupingModelChange, handleRowGroupingModelChange)
+apiRef.current.subscribeEvent('rowGroupingModelChange', handleRowGroupingModelChange)

-apiRef.current.publishEvent(GridEvents.rowExpansionChange)
+apiRef.current.publishEvent('rowExpansionChange')

-useGridApiEventHandler(GridEvents.rowGroupingModelChange, handleRowGroupingModelChange)
+useGridApiEventHandler('rowGroupingModelChange', handleRowGroupingModelChange)

Goals

  • Do not leak pro-only and premium-only code on the community package
  • Needed to allow user to create there own plugins with there own events

Work to do

  • V5: Stop using GridEvents in our codebase and docs (replace with the string which is already supported)
  • V5: Mark GridEvents as deprecated (I don't see how we could do a runtime warning)
  • V5 : Move the comments from GridEvents to GridEventLookup and update buildGridEventsDocumentation
  • V6: Remove GridEvents
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! v6.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant