fix: track visual modality so dialogs are refreshed on hotswap - #25417
Open
totally-not-ai[bot] wants to merge 2 commits into
Open
fix: track visual modality so dialogs are refreshed on hotswap#25417totally-not-ai[bot] wants to merge 2 commits into
totally-not-ai[bot] wants to merge 2 commits into
Conversation
Dialogs are visually modal by default since 25.0, and ModalityMode.VISUAL was mapped to setChildModeless, so a component with visual modality was not tracked on the server side at all. Both the code paths that deal with overlays attached to the UI instead of the route are guarded by UI.hasModalComponent(), so with an open dialog they became no-ops: AbstractNavigationStateRenderer no longer detached the dialog on a route refresh, leaving it visible with outdated contents, and Hotswapper no longer requested a refresh of the whole route chain. Components set to ModalityMode.VISUAL are now tracked in UIInternals without making the UI inert, keeping the meaning of hasModalComponent() and the inert semantics unchanged, and both call sites take the new information into account. Fixes #25415
Tracking strict and visual modality in two separate stacks made getModalityComponents() report the components in the wrong order and, when a component switched between the two modes, report it twice. Components with modality are now kept in one stack, in the order they were set, while the existing modal component stack keeps taking care of the inert state only. Registration of the detach listener that stops tracking a component is idempotent, so repeatedly applying the same modality to a component does not pile up listeners on its element.
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Dialogs are visually modal by default since 25.0, but
ModalityMode.VISUALwas mapped tosetChildModeless, so a component with visual modality was not tracked on the server side at all.Both code paths that deal with overlays attached to the UI instead of the route were guarded by
UI.hasModalComponent(), so with an open dialog they became no-ops:AbstractNavigationStateRendererno longer detached the dialog on a route refresh, leaving it visible with outdated contents.Hotswapperno longer requested a refresh of the whole route chain.What changed
ModalityMode.VISUALare now tracked inUIInternalswithout making the UI inert. The meaning ofhasModalComponent()and the inert semantics are unchanged; the newhasModalityComponent()/getModalityComponents()cover both strict and visual modality, and both call sites take the new information into account.getModalityComponents()report the components in the wrong order and, when a component switched between the two modes, report it twice.cleanModalComponents()inAbstractNavigationStateRenderernow removes all components with modality onREFRESH_ROUTE, instead of draining only the strict-modal stack. Modeless components are left untouched.Fixes #25415
API Changes
com.vaadin.flow.component.internal.UIInternals