fix(module:overlay): Interop delElementFrom() exception on page refresh #1008
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.
🤔 This is a ...
💡 Background and solution
Commit 6ff010c
Removes js event handler firing on window resize from
OverlayTrigger
(this event handler is used to move the overlay as window resizes) on Dispose().Commit be31e33
When
Overlay
is disposed, it tries to remove itself from the DOM. This works well when a page is changed using built in navigation or when a particular component is removed by the framework.This does not work well when the page is for example refreshed or new address is typed manually, because the dispose method is trying to remove DOM element that no longer exists.
To recreate:
npm start
https"//localhost:5001
components/tooltip
The problem was fixed by registering a js event
beforeunload
that when fired changes a private flagbool _isReloading
. If this flag is set totrue
, the call to jsdelElementFrom
is not firing during disposal.☑️ Self Check before Merge