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

Sites dashboard: redirect to My Home without flashing preview pane #97172

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

fushar
Copy link
Contributor

@fushar fushar commented Dec 6, 2024

Fixes #97109

Proposed Changes

After we removed JS overrides from sites dashboard (pbxlJb-6DF-p2), many logic around it are not necessary anymore. However, we have a regression where we show a flashing preview pane when a row click leads to My Home.

This is due to a different implementation of how we tell DataViews which site is currently selected. Previously we maintain a dataViewsState.selectedItem; now we use Calypso's selectedSite directly, which is ultimately derived from the URL. When the URL is redirected /home/:site, we're already too late in stopping the preview pane from opening.

This PR cleans up the logic and fixes the regression, by returning null in SitesDashboard when a site is selected but the route is not matching a valid site dashboard route.

Before After
Screen.Capture.on.2024-12-05.at.17-56-16.mp4
mG73Ox.mp4

Testing Instructions

It's hard to log in as different user in Calypso live URLs in other browser, so we can use P2s instead:

  1. Go to /p2s.
  2. Click on a P2.
  3. Verify you are redirected to My Home without a flashing content.

Regression testing: click around on /sites and verify that nothing related to opening/closing preview panes breaks.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@matticbot
Copy link
Contributor

matticbot commented Dec 6, 2024

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

App Entrypoints (~100 bytes removed 📉 [gzipped])

name           parsed_size           gzip_size
entry-stepper       -349 B  (-0.0%)     -100 B  (-0.0%)
entry-main          -349 B  (-0.0%)     -100 B  (-0.0%)
entry-login         -349 B  (-0.0%)     -100 B  (-0.0%)

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

Sections (~386 bytes added 📈 [gzipped])

name                               parsed_size           gzip_size
staging-site                            +101 B  (+0.0%)      +40 B  (+0.0%)
sites-dashboard                         +101 B  (+0.0%)      +52 B  (+0.0%)
site-tools                              +101 B  (+0.0%)      +41 B  (+0.0%)
site-settings                           +101 B  (+0.0%)      +39 B  (+0.0%)
site-performance                        +101 B  (+0.0%)      +50 B  (+0.0%)
site-overview                           +101 B  (+0.0%)      +41 B  (+0.0%)
site-monitoring                         +101 B  (+0.0%)      +41 B  (+0.0%)
site-marketing                          +101 B  (+0.0%)      +46 B  (+0.0%)
site-logs                               +101 B  (+0.0%)      +41 B  (+0.0%)
hosting-features                        +101 B  (+0.0%)      +45 B  (+0.0%)
hosting                                 +101 B  (+0.0%)      +41 B  (+0.0%)
github-deployments                      +101 B  (+0.0%)      +51 B  (+0.0%)
purchases                                -30 B  (-0.0%)      -11 B  (-0.0%)
plugins                                  -27 B  (-0.0%)       -7 B  (-0.0%)
jetpack-cloud-plugin-management          -27 B  (-0.0%)       -7 B  (-0.0%)
site-blocks                              -26 B  (-0.0%)      -12 B  (-0.0%)
security                                 -26 B  (-0.0%)      -12 B  (-0.0%)
privacy                                  -26 B  (-0.0%)      -12 B  (-0.0%)
notification-settings                    -26 B  (-0.0%)      -12 B  (-0.0%)
me                                       -26 B  (-0.0%)      -12 B  (-0.0%)
help                                     -26 B  (-0.0%)      -12 B  (-0.0%)
developer                                -26 B  (-0.0%)      -12 B  (-0.0%)
account-close                            -26 B  (-0.0%)      -12 B  (-0.0%)
account                                  -26 B  (-0.0%)      -12 B  (-0.0%)
reader                                   -16 B  (-0.0%)       -1 B  (-0.0%)
woocommerce-installation                 -12 B  (-0.0%)       -2 B  (-0.0%)
woocommerce                              -12 B  (-0.0%)       -2 B  (-0.0%)
themes                                   -12 B  (-0.0%)       -4 B  (-0.0%)
theme                                    -12 B  (-0.0%)       -4 B  (-0.0%)
subscribers                              -12 B  (-0.0%)       -2 B  (-0.0%)
stats                                    -12 B  (-0.0%)       -2 B  (-0.0%)
site-purchases                           -12 B  (-0.0%)       -3 B  (-0.0%)
settings-writing                         -12 B  (-0.0%)       -2 B  (-0.0%)
settings-security                        -12 B  (-0.0%)       -2 B  (-0.0%)
settings-reading                         -12 B  (-0.0%)       -2 B  (-0.0%)
settings-podcast                         -12 B  (-0.0%)       -2 B  (-0.0%)
settings-performance                     -12 B  (-0.0%)       -2 B  (-0.0%)
settings-newsletter                      -12 B  (-0.0%)       -2 B  (-0.0%)
settings-jetpack                         -12 B  (-0.0%)       -2 B  (-0.0%)
settings-discussion                      -12 B  (-0.0%)       -2 B  (-0.0%)
settings                                 -12 B  (-0.0%)       -3 B  (-0.0%)
scan                                     -12 B  (-0.0%)       -2 B  (-0.0%)
promote-post-i2                          -12 B  (-0.0%)       -2 B  (-0.0%)
preview                                  -12 B  (-0.0%)       -2 B  (-0.0%)
posts-custom                             -12 B  (-0.0%)       -2 B  (-0.0%)
posts                                    -12 B  (-0.0%)       -2 B  (-0.0%)
plans                                    -12 B  (-0.0%)       -4 B  (-0.0%)
people                                   -12 B  (-0.0%)       -2 B  (-0.0%)
pages                                    -12 B  (-0.0%)       -2 B  (-0.0%)
migrate                                  -12 B  (-0.0%)       -2 B  (-0.0%)
media                                    -12 B  (-0.0%)       -3 B  (-0.0%)
marketplace                              -12 B  (-0.0%)       -4 B  (-0.0%)
marketing                                -12 B  (-0.0%)       -5 B  (-0.0%)
jetpack-social                           -12 B  (-0.0%)       -2 B  (-0.0%)
jetpack-search                           -12 B  (-0.0%)       -2 B  (-0.0%)
jetpack-connect                          -12 B  (-0.0%)       -4 B  (-0.0%)
jetpack-cloud-settings                   -12 B  (-0.0%)       -3 B  (-0.0%)
jetpack-cloud-pricing                    -12 B  (-0.0%)       -2 B  (-0.0%)
jetpack-cloud-overview                   -12 B  (-0.0%)       -4 B  (-0.0%)
jetpack-cloud-features-comparison        -12 B  (-0.0%)       -2 B  (-0.0%)
jetpack-cloud                            -12 B  (-0.0%)       -2 B  (-0.0%)
import                                   -12 B  (-0.0%)       -3 B  (-0.0%)
home                                     -12 B  (-0.0%)       -4 B  (-0.0%)
gutenberg-editor                         -12 B  (-0.0%)       -2 B  (-0.0%)
google-my-business                       -12 B  (-0.0%)       -2 B  (-0.0%)
export                                   -12 B  (-0.0%)       -2 B  (-0.0%)
email                                    -12 B  (-0.0%)       -3 B  (-0.0%)
earn                                     -12 B  (-0.0%)       -2 B  (-0.0%)
domains                                  -12 B  (-0.0%)       -3 B  (-0.0%)
customize                                -12 B  (-0.0%)       -2 B  (-0.0%)
concierge                                -12 B  (-0.0%)       -2 B  (-0.0%)
comments                                 -12 B  (-0.0%)       -2 B  (-0.0%)
checkout                                 -12 B  (-0.0%)       -2 B  (-0.0%)
backup                                   -12 B  (-0.0%)       -2 B  (-0.0%)
add-ons                                  -12 B  (-0.0%)       -2 B  (-0.0%)
activity                                 -12 B  (-0.0%)       -2 B  (-0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~12 bytes removed 📉 [gzipped])

name                               parsed_size           gzip_size
async-load-calypso-reader-sidebar        -26 B  (-0.0%)      -12 B  (-0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

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.

@fushar fushar force-pushed the sites-fix-home-redirect branch from ffd943a to d36b82c Compare December 6, 2024 15:30
@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug sites-fix-home-redirect on your sandbox.

@fushar fushar marked this pull request as ready for review December 6, 2024 15:51
@fushar fushar requested a review from a team as a code owner December 6, 2024 15:51
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 6, 2024
@fushar fushar self-assigned this Dec 6, 2024
@fushar fushar requested review from a team and removed request for a team December 6, 2024 15:54
@fushar fushar force-pushed the sites-fix-home-redirect branch from d36b82c to 2f65e51 Compare December 8, 2024 14:48
Copy link
Contributor

@taipeicoder taipeicoder left a comment

Choose a reason for hiding this comment

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

Tested on a P2 site and a Jetpack-connected site and it works as intended 👍

@fushar fushar merged commit f2d386b into trunk Dec 9, 2024
11 checks passed
@fushar fushar deleted the sites-fix-home-redirect branch December 9, 2024 06:28
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sites dashboard: Clicking a site as non-admin leads to a broken flashing state
3 participants