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.
Backstory:
Currently components that are passed to the
useModal()
hook are rendered once and never update unless you close the modal and reopen it again. This causes a wide range of troubles since all modals are basically isolated from the rest of the app due to inability to update via prop changes.This PR provides backwards-compatible way to make components passed to
useModal()
hook react to changes. By default alluseModal()
hooks behave as they always were, now you can pass 3d argumentupdateOnPropsChange
if you want modal component to be reactive to prop changes. Also 4th argumentmodalId
(just string id) is required if you have multipleuseModal()
hook on the page to prevent one modal updating instead of the other.As noted in code comments - this solution feels a bit clunky and it would be better to rethink how we work with modals, its been creating quite a lot of issues lately. For now this is just quick backwards-compatible solution so we can move on with our plans.