perf(many): reduce delay when performing overlay or page transitions #26189
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.
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Issue URL: resolves #24346
Prior to Ionic adopting
dist-custom-elements
bundle, everything use the lazy loaded bundle. This meant that there was a brief period in between when a component was requested and when the component assets were loaded/registered/rendered where the component would show up blank or without styles. To mitigate this, previous maintainers introduced thedeepReady
function that looked for every child Stencil component and waited for each component'scomponentOnReady
method to resolve. Once those all resolved, this meant that all the components were loaded and whatever pending operations could proceed.Now that some parts of Ionic adopted the
dist-custom-elements
bundle, this is no longer needed and is causing unnecessary delays when opening modals, switching tabs, and more.Additionally, a workaround was added to Ionic Vue to account for this same lazy loaded issue. Specifically, this was added to address layout shift issues in the old lazy loaded version of Ionic Vue: #22052. Now that Ionic Vue uses
dist-custom-elements
, this was causing unnecessary delays.What is the new behavior?
deepReady
when running in a lazy loaded environment. (For now this is non-CE build core and Ionic Angular).deepWait
. Whether or notdeepWait
should be true is now determined by thehasLazyBuild
function in@ionic/core
.shallowReady
function has been removed. This function was never getting called since all 3 framework integrations previously forceddeepWait
to betrue
.requestAnimationFrame
calls in Ionic Vue's transition function have been removed.Note: Once Ionic Angular is updated to use
dist-custom-elements
, Ionic Angular devs will automatically get this perf boost.Does this introduce a breaking change?
Other information
The video below shows that there are no layout shifts after removing the two
requestAnimationFrame
calls. This was tested on a Samsung Galaxy S6.tab-switch-vue-android.mp4
The table below shows some rough benchmarks for how much tab switches will speed up by. These tests were conducted using https://github.com/Livijn/lag-tester. I placed
onIonViewWillEnter
andonIonViewDidEnter
hooks in thesetup
function for Tab2 and usedperformance.now()
to measure the time between when each hook was run. This allowed me to only measure the work that Ionic was doing.Values were rounded to the nearest tenth of a millisecond. These tests were conducted on a Samsung Galaxy S6.
Switching from Tab 1 to Tab 2 for the first time
main
FW-406
Switching from Tab 1 to Tab 2 after Tab 2 has already been visited
main
FW-406