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

Refactor list of site importers into a single location #91609

Merged
merged 6 commits into from
Jun 10, 2024

Conversation

markbiek
Copy link
Contributor

@markbiek markbiek commented Jun 7, 2024

Related to #90635

Proposed Changes

This updates the getConfig function in client/lib/importer/importer-config.tsx to be the single source of information about available site importers.

It also updates the ListStep and getFinalImporterUrl helper so they pull the data they need from the updated getConfig function.

This is done with two new functions:

  • getImporterEngines which returns a list of the importer engine slugs.
  • getImportersAsImporterOption which returns either the primary or secondary importers in the ImporterOption format.

Why are these changes being made?

Previously, there were multiple lists of importers in different places. Having a single source of truth will make it easier to keep track of things and make updates.

Testing Instructions

There are tests for the two new functions for retrieving importer details:

yarn test-client client/lib/importer/test/importer-config.tsx

To test the actual UI, you can use either calypso.live or check out this branch and run it locally.

Then there are two ways to get to the importer list.

  1. Visit /sites, click the ^ next to "Add new site" and click "Import an existing site".
  2. Or you can go through /start and select the "Import existing content or website" Goal.

You'll eventually arrive at the "Let's find your site" step
image

Click "pick your current platform from a list". You should be taken to "Import content from another platform".
6t3z50ieOx7qalbMSXgKqUYtgKoV3Z72Mk7yp1Dd.jpg

From here, verify that the options are displaying correctly.

Then try clicking a few of the importers in the top section and in the "Other platforms" dropdown.

You should be taken to the correct import page for the source slte you selected.

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 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 Jun 7, 2024

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

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

name                   parsed_size           gzip_size
entry-subscriptions          -84 B  (-0.0%)      -41 B  (-0.0%)
entry-stepper                -84 B  (-0.0%)      -32 B  (-0.0%)
entry-main                   -84 B  (-0.0%)      -39 B  (-0.0%)
entry-login                  -84 B  (-0.0%)      -41 B  (-0.0%)
entry-domains-landing        -84 B  (-0.0%)      -41 B  (-0.0%)
entry-browsehappy            -84 B  (-0.0%)      -41 B  (-0.1%)

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

Sections (~493 bytes removed 📉 [gzipped])

name                     parsed_size           gzip_size
import-hosted-site-flow      +1576 B  (+0.2%)    +1230 B  (+0.5%)
import                       +1239 B  (+0.2%)    +1174 B  (+0.7%)
import-flow                  +1131 B  (+0.0%)     +368 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.

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.

@markbiek markbiek force-pushed the 90635-update/available-importers-refactor branch from 71dca8e to c0e072a Compare June 7, 2024 18:18
@markbiek markbiek force-pushed the 90635-update/available-importers-refactor branch from c0e072a to 5e5d1e9 Compare June 10, 2024 13:33
@markbiek
Copy link
Contributor Author

markbiek commented Jun 10, 2024

Noting that I don't think those test failures are related to this PR. I tried running them locally against trunk and they failed the same way.

I was seeing similar behavior last week with different tests.

And now all the tests pass 🤷

@markbiek markbiek changed the title WIP: 90635 update/available importers refactor Refactor list of site importers into a single location Jun 10, 2024
@markbiek markbiek self-assigned this Jun 10, 2024
@markbiek markbiek requested a review from a team June 10, 2024 14:04
@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 Jun 10, 2024
@markbiek markbiek marked this pull request as ready for review June 10, 2024 14:22
@markbiek markbiek requested a review from a team as a code owner June 10, 2024 14:22
@markbiek markbiek force-pushed the 90635-update/available-importers-refactor branch from 5e5d1e9 to 8707a0a Compare June 10, 2024 14:22
@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 90635-update/available-importers-refactor on your sandbox.

@sixhours
Copy link
Contributor

For some reason I'm seeing Wix in the primary importers list locally, but not on calypso.live. 🤔 Is there a reason for that, do you know?

It's no longer in use
@markbiek
Copy link
Contributor Author

For some reason I'm seeing Wix in the primary importers list locally, but not on calypso.live. 🤔 Is there a reason for that, do you know?

@sixhours Hmm. I'm not seeing it locally or calypso.live.

Which path did you take? Was it /start or the import menu from /sites?

Copy link
Contributor

@sixhours sixhours 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 working for me!

@sixhours
Copy link
Contributor

For some reason I'm seeing Wix in the primary importers list locally, but not on calypso.live. 🤔 Is there a reason for that, do you know?

@sixhours Hmm. I'm not seeing it locally or calypso.live.

Which path did you take? Was it /start or the import menu from /sites?

Nevermind, I don't see it there now. 🙃

@markbiek markbiek merged commit 2b32d93 into trunk Jun 10, 2024
11 checks passed
@markbiek markbiek deleted the 90635-update/available-importers-refactor branch June 10, 2024 19:22
@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 Jun 10, 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