-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Replace isWooCoreProfilerFlow with isPasswordlessJetpackConnectionFlow #95504
Replace isWooCoreProfilerFlow with isPasswordlessJetpackConnectionFlow #95504
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~114 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~123 bytes added 📈 [gzipped])
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 (~46 bytes added 📈 [gzipped])
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. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! @moon0326 This is a great improvement. 👍 I have a few comments:
I searched the isWooCoreProfiler
in the codebase and looks like we still have many references to it. Is this expected?
Personally, I think isPasswordlessJetpackConnectionFlow
is bit confusing. Especially, when I see the code like this:
isWooCoreProfilerFlow={ isPasswordlessJetpackConnection }
or
isWoo: isWooOAuth2Client( oauth2Client ) || isPasswordlessJetpackConnectionFlow( state ),
I wonder if we should also have Woo
in the function name like isWooPasswordlessJPCFlow
or something similar, but maybe require more opinions on this. Just wanted to bring this up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @chihsuan, isPasswordlessJetpackConnection
sounds confusing especially if it's exclusively used by Woo.
( get( getInitialQueryArguments( state ), 'from' ) === 'woocommerce-payments' || | ||
get( getCurrentQueryArguments( state ), 'from' ) === 'woocommerce-payments' ) && | ||
( get( getInitialQueryArguments( state ), 'plugin_name' ) === 'woocommerce-payments' || | ||
get( getCurrentQueryArguments( state ), 'plugin_name' ) === 'woocommerce-payments' ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think we should declare get( getInitialQueryArguments( state ), 'from' )
and get( getInitialQueryArguments( state ), 'plugin_name' )
as variables here, I feel it's too long to read clearly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilyasfoo Good call! Updated it in Clean up isWooCommercePaymentsOnboardingFlow function
Not sure how I missed that many 😮 I'll work on it.
Good call. I'll work on it 👍 |
4195a01
to
5174b4e
Compare
I've updated the function name in Rename isPasswordlessJetpackConnectionFlow to isWooPasswordlessJPCFlow and Replace isWooCoreProfiler var with isWooPasswordlessJPC and update th… |
Thanks, @moon0326! It seems there are test fails and I suspect is related to the PR: |
5174b4e
to
caf7164
Compare
Thank you for the catch 👍 Fixed it in Fix broken test and rename isWooCoreProfiler prop to isWooPasswordles… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Tested well. 👍
Just left a minor suggestion.
client/lib/login/index.js
Outdated
@@ -78,6 +78,14 @@ export function getSignupUrl( currentQuery, currentRoute, oauth2Client, locale, | |||
includes( get( currentQuery, 'redirect_to' ), '/jetpack/connect/authorize' ) && | |||
includes( get( currentQuery, 'redirect_to' ), '_wp_nonce' ) | |||
) { | |||
// If the current query has plugin_name param, but redirect_to doesn't, add it to the redirect_to | |||
const pluginName = get( currentQuery, 'plugin_name' ); | |||
const urlObj = new URL( currentQuery.redirect_to ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps, we can add a try-catch block here to handle the case where the redirect_to is not a valid URL. Of current Query.redirect_to
is not a valid URL, it will throw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chihsuan good suggestion! Updated it in Try catch for invalid redirect_to value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, @moon0326. I think there's at least 1 more instance of isWooCoreProfilerFlow
@ilyasfoo Thank you for the catch. I think that came from rebase. Updated it in Replace isWooCoreProfiler to isWooPasswordlessJPC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @moon0326! Tests well, LGTM! 🚢
Related to #95041
This is an enhanced version of #95041
Proposed Changes
isWooCoreProfilerFlow
withisPasswordlessJetpackConnectionFlow
. This is a more abstract approachto determining whether to display the new Jetpack connection page.
isPasswordlessJetpackConnectionFlow
checks forisWooCoreProfilerFlow
andisWooCommercePaymentsOnboardingFlow
Testing Instructions
Jetpack
on the extensions page.from
towoocommerce-payments
and addplugin_name=woocommerce-payments
param to the URL and then copy the URL.Pre-merge Checklist