Skip to content

Update loading state of jetpack magic login in better way #102246

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

Merged
merged 3 commits into from
Apr 9, 2025

Conversation

CodeyGuyDylan
Copy link
Contributor

@CodeyGuyDylan CodeyGuyDylan commented Mar 31, 2025

Proposed Changes

  • Use state variable that is updated by Login form rather than a class variable updated by the parent

Why are these changes being made?

  • The way this was handled before with a class variable that was updated directly on componentDidMount is not usually how these types of things are done in React.
  • The update, while is still essentially a check to see if the component has mounted, makes it so we do so through react state updates instead to make it more unified in its approach to state updates with the rest of the class

Testing Instructions

  1. Start a Jurassic Ninja site with Bleeding edge checked out
  2. Go to /wp-admin/admin.php?page=my-jetpack#/onboarding on the site
  3. Fill out your email and submit the form
    image
  4. When you are sent to the loading page, you will see the flashes that were reported
  5. Start up your local Calypso environment (or use the live link) and replace the domain in the URL. Reload the page and you should see a loading indicator until the email was sent
loading-state.mov

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)?

Copy link

github-actions bot commented Mar 31, 2025

@matticbot
Copy link
Contributor

matticbot commented Mar 31, 2025

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

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

name         parsed_size           gzip_size
entry-login       +102 B  (+0.0%)      +18 B  (+0.0%)

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

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.

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

Isn't this more or less the same approach like the isInitialMount property was doing, but just done with a state variable?

It still feels like we're not addressing the root cause, but working around it.

Do we know the root cause and what else have we tried to resolve the issue?

@CodeyGuyDylan
Copy link
Contributor Author

Isn't this more or less the same approach like the isInitialMount property was doing, but just done with a state variable?

It still feels like we're not addressing the root cause, but working around it.

Do we know the root cause and what else have we tried to resolve the issue?

The root cause is that any loading state variable that I could use to check to see if the form is ready defaults to false. This causes a flash on the screen until that loading variable is set to true. The reason I chose not to just change the default to true is because the flow is very complex and I have little knowledge about other uses of it, and if I were to change the default to true, I am unsure of all the places where I'd need to set it to false in the event that a certain variation of the flow doesn't need to load that data.

I could look more into it to get a more complete understanding the flow and all the variations, however I am currently the only person on my team present during these hours of the day and with the onboarding releasing today in the Jetpack release I don't currently have time to do that. I will keep it on our things to look at for i2 of the onboarding flow so hopefully we can fix the root issue later. Thank you for taking a look at this

@tyxla
Copy link
Member

tyxla commented Apr 3, 2025

Thanks @CodeyGuyDylan!

Would be nice if we follow up on this at some point @Automattic/jetpack-martech

@grzegorz-cp
Copy link
Contributor

I will look after this PR next week.

@grzegorz-cp grzegorz-cp self-assigned this Apr 3, 2025
@grzegorz-cp
Copy link
Contributor

@tyxla I updated the PR because there were some conflicts and I'd like to merge it tomorrow. Let me know if you have any concerns.

@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

  • help-center
  • notifications

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/loading-state-of-jetpack-magic-login on your sandbox.

Copy link
Contributor

@grzegorz-cp grzegorz-cp left a comment

Choose a reason for hiding this comment

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

I resolved conflicts after merging trunk and tested it 👍

@grzegorz-cp grzegorz-cp merged commit d7b83fa into trunk Apr 9, 2025
13 checks passed
@grzegorz-cp grzegorz-cp deleted the update/loading-state-of-jetpack-magic-login branch April 9, 2025 23:47
@tyxla
Copy link
Member

tyxla commented Apr 10, 2025

@grzegorz-cp if you read my feedback above, I did have some concerns which remained unaddressed: #102246 (comment)

@grzegorz-cp
Copy link
Contributor

Thank you, we will be tracking it here

JessBoctor pushed a commit to JessBoctor/wp-calypso that referenced this pull request Apr 15, 2025
…#102246)

* Use state variable rather than class variable to update loading state for jetpack magic login

* Enable magic link signup for testing branches

---------

Co-authored-by: Grzegorz Chudzinski-Pawlowski <[email protected]>
JessBoctor pushed a commit to JessBoctor/wp-calypso that referenced this pull request Apr 17, 2025
…#102246)

* Use state variable rather than class variable to update loading state for jetpack magic login

* Enable magic link signup for testing branches

---------

Co-authored-by: Grzegorz Chudzinski-Pawlowski <[email protected]>
grzegorz-cp added a commit that referenced this pull request Apr 28, 2025
grzegorz-cp added a commit that referenced this pull request May 1, 2025
* Revert "Update loading state of jetpack magic login in better way (#102246)"

This reverts commit d7b83fa.

* Removing old spinner
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.

4 participants