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
feat: Add onLayoutInit callback #1811
base: master
Are you sure you want to change the base?
Conversation
This work aims to add an `onLayoutInit` callback, that is called inside the componentDidMount, once the layout has been possibly corrected.
I'm not sure why this is needed - |
The goal of this PR is to be able to distinguish between the very first call to I have a use case where I want to keep a dirty state of my layout, in order to inform users whether they have unsaved modifications. Some layouts need to be corrected by RGL, so I need to set my layout reference after it has been possibly corrected. At the moment, I have no way of distinguishing between |
Seems a local variable, e.g. ( That is, you can know if the layout has changed if you've hit |
I'm not sure to understand how you would do. The layout is considered initialized once it has been "auto-corrected". Since it displays remote data, it might or might not get autocorrected. How can I get the information that the layout has been autocorrected, and that I can use the new layouts as reference? Since my description of the issue was most likely not enough detailed to understand the issue I'm trying to resolve, I created a codesandbox, to illustrate the issue.
On the left, you can see the example with the issue ( |
@STRML Did you have the chance to take a look to the codesandbox I provided ? It should illustrate the issue I faced. |
Try this sandbox (modifications in |
Goal of the PR
The goal of this PR is to be able to distinguish between the very first call to
onLayoutChange
made by RGL, from the ones that could be triggered manually by users.Technical details
This work aims to add an
onLayoutInit
callback, that is called inside the componentDidMount, once the layout has been possibly corrected.Practical use case
I have a use case where I want to keep a dirty state of my layout, in order to inform users whether they have unsaved modifications.
To handle this dirty state, I'm comparing the current layout with a reference layout stored after initialization.
Some layouts need to be corrected by RGL, so I need to set my layout reference after it has been possibly corrected.
At the moment, I have no way of distinguishing between
onLayoutChange
calls. (manually triggered by users VS called by RGL to "correct" the layout)An
onLayoutInit
callback does the job and allows me to set my reference layout once the layout has been possibly corrected.