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

fix(hosting-overview-refinements): fix rendering atomic website as simple #93843

Conversation

nightnei
Copy link
Contributor

@nightnei nightnei commented Aug 23, 2024

Related to https://github.com/Automattic/dotcom-forge/issues/8771

Why are these changes being made?

When a site becomes atomic and we redirect a user from "Hosting Features" to "Hosting Overview" - we can notice that we have fglash of incorrect state of UI - initially we see UI from Atomic website and then i an few seconds we see incorrect UI, for Simple site (but the site is Atomic).

Testing Instructions

Before testing, recommend watching this video and reading the description there p1724404907834529/1724373252.261939-slack-C06ELHR6L9J

A4A tests

  1. Open https://agencies.automattic.com/
  2. Purchase licences, if you don't have (Left sidebar "Purchase" -> "Issue New License")
  3. Click on Sites in left sidebar
  4. Click on "Needs setup"
  5. Click on "Create new site" and proceed
  6. Wait till you see the next notification
    Screenshot 2024-08-13 at 12 58 24
  7. Copy selected domain on the screenshot above
  8. And open new tab with the next URL http://calypso.localhost:3000/hosting-features/<COPYED_DOMAIN_IN_7TH_STEP>
  9. Assert that you see spinner and copy about "things in progress"
    Screenshot 2024-08-13 at 13 00 43
  10. Wait till it's finished
  11. Assert that you are redirected to "Overview" tab and you see tabs list for Atomic website (before it was bug when we see tabs for Simpel websites)
BEFORE AFTER
Screenshot 2024-08-23 at 11 21 55 Screenshot 2024-08-23 at 11 20 29

Manually turning on Hosting Features

  1. Purchase domain with Starter plan
  2. Open "Hosting features" tab on "Sites" page (Let's call this tab as A during testing)
  3. Copy the URL and open a separate tab (Let's call this tab as B during testing, we will use it in the end for testing)
  4. In tab A, click Upgrade now and proceed with upgrading
  5. Now let's repeat the 3-rd step to open one more separate tab (Let's call this tab as C during testing, we will use it in the end for testing), so that you will have the next tabs B and C:
    Screenshot 2024-07-29 at 16 12 45
  6. Now, in tab A click Activate now and proceed
  7. During activating process, the copy on tabs B and C should be changed to the next (with CTA buttons hidden)
    Screenshot 2024-07-29 at 16 15 28
  8. Wait till it's finished
  9. Assert that you are redirected to "Overview" tab and you see tabs list for Atomic website (before it was bug when we see tabs for Simpel websites)
BEFORE AFTER
Screenshot 2024-08-23 at 11 21 55 Screenshot 2024-08-23 at 11 20 29

@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 nightnei/fixRenderingAtomicWebsiteAsSimple on your sandbox.

@matticbot
Copy link
Contributor

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

Sections (~174 bytes added 📈 [gzipped])

name                             parsed_size           gzip_size
hosting-features                      +365 B  (+0.0%)     +108 B  (+0.0%)
staging-site                           +59 B  (+0.0%)      +30 B  (+0.0%)
sites-dashboard                        +57 B  (+0.0%)      +28 B  (+0.0%)
site-monitoring                        +57 B  (+0.0%)      +28 B  (+0.0%)
site-logs                              +57 B  (+0.0%)      +28 B  (+0.0%)
hosting                                +57 B  (+0.0%)      +28 B  (+0.0%)
github-deployments                     +57 B  (+0.0%)      +28 B  (+0.0%)
switch-site                            +55 B  (+0.0%)      +32 B  (+0.1%)
plugins                                +55 B  (+0.0%)      +27 B  (+0.0%)
jetpack-cloud-plugin-management        +55 B  (+0.0%)      +27 B  (+0.0%)
import-hosted-site-flow                +55 B  (+0.0%)      +31 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 (~32 bytes added 📈 [gzipped])

name                                       parsed_size           gzip_size
async-load-calypso-layout-command-palette        +55 B  (+0.0%)      +32 B  (+0.1%)

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.

@nightnei nightnei changed the title chore: resolve conflicts fix(hosting-overview-refinements): fix rendering atomic website as simple Aug 23, 2024
@nightnei nightnei marked this pull request as ready for review August 23, 2024 10:22
@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 Aug 23, 2024
Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

I did a quick assessment to determine if #93503 might have fixed this bug, but I don't think it did.

I also left some comments yesterday on Slack. This review follows up on those comments and adds another idea.

@nightnei, let's also merge trunk into this before the next review, since there might be some conflicts to resolve.

Comment on lines +32 to +41
export const queryKeyForAllSitesWithThemeSlug = [
USE_SITE_EXCERPTS_QUERY_KEY,
SITE_EXCERPT_REQUEST_FIELDS,
SITE_EXCERPT_REQUEST_OPTIONS,
[],
'all',
[],
[ 'theme_slug' ],
];

Copy link
Contributor

Choose a reason for hiding this comment

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

Closing the loop: I mentioned on Slack that I think we should replace this with a getUseSiteExcerptsQueryKey function. That function should be used internally in useSiteExcerptsQuery and when invalidating the query.

@@ -91,8 +94,11 @@ const HostingFeatures = () => {

if ( siteTransferData?.status === transferStates.COMPLETED ) {
dispatch( fetchAtomicTransfer( siteId ) as unknown as AnyAction );
queryClient.invalidateQueries( {
queryKey: queryKeyForAllSitesWithThemeSlug,
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use getUseSiteExcerptsQueryKey here. @nightnei and I discussed how we can ensure that we target the exact same query key that's used in client/hosting/sites/components/sites-dashboard.tsx, but I think we should consider not doing that.

By specifying a shorter key when invalidating queries, react-query will invalidate all queries with longer keys matching that prefix. For example, if we invalidate the key ['sites'], queries for ['sites', 'all'] will also be invalidated.

This seems like an appropriate case to make use of that. We can invalidate all useSiteExcerptsQuery instances where site_visibility === all and just not specify additional_fields and additional_options.

Thoughts, @nightnei?

@nightnei
Copy link
Contributor Author

Closing two PRs regarding detecting of transfering status (#93843 && #93789) since looks like the bug was fixed at the backend, it's not reproducible anymore. Details - p1729707255863149-slack-C04GESRBWKW.

@nightnei nightnei closed this Oct 24, 2024
@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 Oct 24, 2024
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