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

Skip render when home page is closing or redirecting #9012

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Jul 16, 2020

The Home page component is responsible for closing the notification window and triggering redirects in various situations. When this happens, the home page is briefly rendered before the redirect/close happens. This is a waste of cycles, and is distracting for users.

We now render nothing if the page is in the process of redirecting or reloading. None of the redirects handled in this component are for sub-pages, so we don't need the Home page to render in any of these cases.

We were already doing this for redirects to transaction confirmations, but now we're taking the same approach for all redirects, and for the cases where the window is closed.

@Gudahtt
Copy link
Member Author

Gudahtt commented Jul 16, 2020

This depends upon #9011

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

This is great! Does it work as intended with multiple queued permissions requests as well?

@Gudahtt
Copy link
Member Author

Gudahtt commented Jul 16, 2020

Yep! It handles multiple permission requests and confirmations perfectly.

Unfortunately it's broken in another way though; the "closing/redirecting" states are set on update, but the actual closing/redirecting only happens on mount. I'm updating it now to ensure the states are only set before mount.

Edit: ^ This has now been fixed.

@Gudahtt Gudahtt force-pushed the skip-render-while-home-page-closing-or-redirecting branch from 08a6869 to 58dddc1 Compare July 16, 2020 12:13
Base automatically changed from keep-notification-open-after-connect-if-confirmations-pending to develop July 16, 2020 12:13
The Home page component is responsible for closing the notification
window and triggering redirects in various situations. When this
happens, the home page is briefly rendered before the redirect/close
happens. This is a waste of cycles, and is distracting for users.

We now render nothing if the page is in the process of redirecting or
reloading. None of the redirects handled in this component are for sub-
pages, so we don't need the Home page to render in any of these cases.

We were already doing this for redirects to transaction confirmations,
but now we're taking the same approach for all redirects, and for the
cases where the window is closed.
@Gudahtt Gudahtt force-pushed the skip-render-while-home-page-closing-or-redirecting branch from 58dddc1 to 6f30472 Compare July 16, 2020 12:13
@metamaskbot
Copy link
Collaborator

Builds ready [6f30472]
Page Load Metrics (769 ± 62 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint34113622612
domContentLoaded45794376812962
load45894476912962
domInteractive45694276712962

@Gudahtt Gudahtt marked this pull request as ready for review July 16, 2020 13:16
@Gudahtt Gudahtt requested a review from a team as a code owner July 16, 2020 13:16
Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@Gudahtt Gudahtt merged commit dbafa49 into develop Jul 16, 2020
@Gudahtt Gudahtt deleted the skip-render-while-home-page-closing-or-redirecting branch July 16, 2020 18:23
@metamaskbot metamaskbot mentioned this pull request Jul 17, 2020
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.

3 participants