Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure code splitting — remove the quick flash white screen when switching pages #3099

Merged
merged 15 commits into from
Feb 1, 2023

Conversation

neuodev
Copy link
Contributor

@neuodev neuodev commented Jan 24, 2023

Background

We implemented lazy loading (aka code splitting) back then when Yoroi was taking so long in the initial loading screen when opening the extension.

The Problem

When switching between tabs/pages we have a quick white flash screen.

Root Cause

It happens because when switching to a new tab that you never visited before the page is not actually there what will happen is while loading this page we will show this blank white screen. This screen is shown because we only have one Suspense with a fallback of null that wrapped the whole application (here)

<Suspense fallback={null}>
  {/* all pages */}
</Suspense>

So whenever page or subpage is still loading we fallback to the blank white screen.

The Solution

  1. Instead of having one Suspense that wraps all pages we scope it into the level of subpages
  2. Don't lazy load some pages like LoadingScreen
  3. For full pages we only move the Suspense to the page content not the whole page

@neuodev neuodev requested review from yushih, Nebyt and vsubhuman January 24, 2023 12:30
@vsubhuman vsubhuman requested a review from nistadev January 30, 2023 10:47
@vsubhuman vsubhuman added this to the 4.19.0 milestone Jan 31, 2023
@neuodev neuodev changed the title Restructure code splitting — aka remove the quick flash white screen when switching pages Restructure code splitting — remove the quick flash white screen when switching pages Feb 1, 2023
@neuodev
Copy link
Contributor Author

neuodev commented Feb 1, 2023

Quick Note:

The big diff in the PR +1,204 −1,091 is from splitting both the VotingPage.js and StakingPage.js into two other pages.
For example the VotingPage.js -> VotingPage.js to wrap the content and add the navbar and the sidebar and VotingPageContent.js includes the actual content/logic of the page

And the same applies to the StakingPage.js!

So the diff comes from just moving the stuff around but on actual adding or deletion was done!

Copy link
Contributor

@vsubhuman vsubhuman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/check

@vsubhuman vsubhuman merged commit 2ea8253 into develop Feb 1, 2023
@vsubhuman vsubhuman deleted the Ahmed/suspense branch February 1, 2023 15:51
@vsubhuman vsubhuman mentioned this pull request Feb 8, 2023
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants