Skip to content

Dashboard V2: Enable link preloading #103283

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open

Conversation

youknowriad
Copy link
Contributor

Fixes DOTCOM-13061

Proposed Changes

Adds preloading to Link component. Check this page for details. The idea is that when a user hovers a link, we preload the loader of the target page before actually navigating to the page.

This works well with regular links, the problem right now is that we can't make the same thing work for DataViews because of how DataViews renders the links, it just uses a regular onClickHandler instead of having a way to actually use links or "hook in" the router somehow.

Testing Instructions

  • Load the "domains" v2 page. (without loading the sites one first, reload the page for instance)
  • Open the dev tools and the network tab
  • Notice that when you hover the "sites" link in the menu, the sites endpoint is preloaded.
  • Clicking the link should be instant.

@youknowriad youknowriad self-assigned this May 9, 2025
@youknowriad youknowriad requested review from a team as code owners May 9, 2025 10:55
@matticbot matticbot added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 9, 2025
@matticbot
Copy link
Contributor

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~36 bytes added 📈 [gzipped])

name                    parsed_size           gzip_size
entry-dashboard-dotcom        +50 B  (+0.0%)      +19 B  (+0.0%)
entry-dashboard-a4a           +50 B  (+0.0%)      +19 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@ntsekouras
Copy link
Member

the problem right now is that we can't make the same thing work for DataViews because of how DataViews renders the links, it just uses a regular onClickHandler instead of having a way to actually use links or "hook in" the router somehow.

Do you think we should do that even if we could? A user could hover over many sites just by wanting to move the cursor somewhere else in the UI.

Copy link
Member

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@ellatrix
Copy link
Contributor

ellatrix commented May 9, 2025

Do you think we should do that even if we could? A user could hover over many sites just by wanting to move the cursor somewhere else in the UI.

We could set a custom delay for these that have a bigger hit-area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Hosting Dashboard [Feature] Performance [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants