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

Store in the Redux state the last username/email checked in the login form #41805

Merged
merged 15 commits into from
Jun 10, 2020

Conversation

DanReyLop
Copy link
Contributor

Changes proposed in this Pull Request

On the login form, when the user fills out their username (or email), an API request is made to see if that username/email exists, and if it does, what kind of authentication to use (passwordless or password). In this PR, that username/email is stored in the Redux state.

I also made it so the requestError is cleared when resetAuthAccountType is called. It's only called here, and it makes sense that when the UI is "reset", the error should be cleared too.

How to test

There's no code that reads the lastCheckedUsernameOrEmail property from Redux, so there's no way to test this.

Note: This is a required refactor for the new "Woo DNA" flow, implemented in #41798

@DanReyLop DanReyLop added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Login labels May 5, 2020
@DanReyLop DanReyLop requested a review from a team May 5, 2020 13:04
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented May 5, 2020

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

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

name         parsed_size           gzip_size
entry-login       +239 B  (+0.0%)      +43 B  (+0.0%)
entry-main         +17 B  (+0.0%)       -4 B  (-0.0%)

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

Sections (~266 bytes added 📈 [gzipped])

name             parsed_size           gzip_size
jetpack-connect       +476 B  (+0.1%)     +154 B  (+0.1%)
accept-invite         +347 B  (+0.1%)      +79 B  (+0.1%)
security              +181 B  (+0.0%)      +33 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 (~110 bytes added 📈 [gzipped])

name                          parsed_size           gzip_size
async-load-signup-steps-user       +347 B  (+0.3%)      +79 B  (+0.3%)
async-load-design-blocks           +222 B  (+0.0%)      +31 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.

@DanReyLop DanReyLop force-pushed the woodna/override-jetpack-help-url branch from 1af1547 to 1f5969c Compare May 5, 2020 15:33
@DanReyLop DanReyLop force-pushed the woodna/add-last-checked-username-to-state branch from c03e721 to 10e51b9 Compare May 5, 2020 15:34
Copy link
Contributor

@vbelolapotkov vbelolapotkov left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@vbelolapotkov vbelolapotkov added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 2, 2020
@DanReyLop DanReyLop force-pushed the woodna/override-jetpack-help-url branch from 1f5969c to 88f6e05 Compare June 8, 2020 10:44
@DanReyLop DanReyLop force-pushed the woodna/add-last-checked-username-to-state branch from 10e51b9 to eff3848 Compare June 8, 2020 10:45
@DanReyLop DanReyLop force-pushed the woodna/add-last-checked-username-to-state branch from eff3848 to 2716df0 Compare June 8, 2020 12:03
@DanReyLop DanReyLop requested a review from oandregal as a June 8, 2020 12:03
@DanReyLop DanReyLop requested review from a team June 8, 2020 12:03
@DanReyLop DanReyLop force-pushed the woodna/override-jetpack-help-url branch from 88f6e05 to 8191ede Compare June 8, 2020 12:05
@DanReyLop DanReyLop removed request for a team and oandregal June 8, 2020 20:48
Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Nice 👍

@@ -489,11 +491,21 @@ export const authAccountType = withoutPersistence( ( state = null, action ) => {
return state;
} );

export const lastCheckedUsernameOrEmail = withoutPersistence( ( state = null, action ) => {
Copy link
Member

Choose a reason for hiding this comment

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

The withoutPersistence wrapper is not really needed -- it's already a default behavior of a reducer without any wrapper. @sgomes added them everywhere in the #36470 codemod, but we will eventually remove them again 🙂

Base automatically changed from woodna/override-jetpack-help-url to master June 10, 2020 08:48
@DanReyLop DanReyLop merged commit 9606781 into master Jun 10, 2020
@DanReyLop DanReyLop deleted the woodna/add-last-checked-username-to-state branch June 10, 2020 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants