Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.