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.
Motivation
The wizard modal opening is glitchy on desktop which really annoys me.
The problem
The wizard modal is glitchy because we noticed issue last year which we solved by wrapping the transition component within a
if
that becametrue
only once the modal intro animation was done. This is the major root cause of the issue. Because the transition is not displayed, the slot it contains is not displayed and per extension the content is not displayed, therefore the height is not correct.In addition to be glitchy, this is also an issue for the browser as if such guard is removed without further code, it can lead the browser to become irresponsive as the component transition ends in an infinite loop (⚠️ 🚨).
After opening and closing the modal a zillion times this afternoon I came to the conclusion that the root cause of the issue is the
onDestroy
side effect of theWizardModal
that is sometimes not called when the modal is used in NNS-dapp.This problem looks like the Svelte issue 👉 sveltejs/svelte#5268
To overcome the issue, I observed the
nnsClose
event of the modal and force not rendering its content when this happens which has for effect to destroy the transition ✅.See screenshots for demos.
Changes
WizardModal
, onnnsClose
, set a flag tofalse
to destroy / not render its content instead of waiting forintroEnd
scale
and replace with afade
effectScreenshots
Current glitch:
Current glitch slowed down:
New animation effect without glitch:
Issue and infinite loop problem if only
introEnd
is removed:No issue if
nnsClose
is used to force deletion of content (no infinite loop happening after a while):