wp-calypso
wp-calypso copied to clipboard
Import flow: fix issue with rendering step content
Proposed Changes
Before this commit, there was a problem with the import flow flickering screens between steps. (switching between loading states) It is a simple fix rendering the JSX component instead of another render method calls.
Testing Instructions
- Go to
/setup/import?siteSlug={SLUG}
- Provide a WordPress web address (ex. jurassic.ninja)
- Uncontrolled switching from screen to loading screen will no longer occur.
Screenshot
Pre-merge Checklist
- [ ] Have you written new tests for your changes?
- [x] Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
- [x] 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)?
Related to #
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:
App Entrypoints (~10 bytes added 📈 [gzipped])
name parsed_size gzip_size
entry-stepper +35 B (+0.0%) +10 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.
I tried to reproduce the issue but can't get the same flickering screens as you, is there any particular situation that can reproduce this bug? I tried switching between steps and had no luck either.
Changing step content into a component seems to have another issue, please see the following video:
https://user-images.githubusercontent.com/4074459/191887170-9ca5b686-0c04-42b8-a996-bfe8028b685a.mov
As you can see there's a flickering for the Install Jetpack button area. Could you double-check if this happens to you as well? I'm thinking this is because the StepContent
function sits inside the parent function, so it's being treated as a new component when it re-renders every time.
I tried to reproduce the issue but can't get the same flickering screens as you, is there any particular situation that can reproduce this bug? I tried switching between steps and had no luck either.
My bad, forgot to mention that site slug should be an atomic, so try with siteSlug={ATOMIC_SLUG}
You are right, after this change, there is another problem with the flickering of the "install jetpack" block. I'll investigate further.
Thanks, @ouikhuan!
My bad, forgot to mention that site slug should be an atomic, so try with siteSlug={ATOMIC_SLUG}
Hmm, I tried with both Atomic and simple sites but can't reproduce on either of them. Could it relate to something else like a browser version or network connection?
Hmm, I tried with both Atomic and simple sites but can't reproduce on either of them. Could it relate to something else like a browser version or network connection?
The app initially gets a list of Site objects, and then we get the current Site object which differs from the initial one, but it updates the state anyway. After the update, there is a missing options
property, which is why we see the case shown in the video in the description of the PR.
I tried with multiple websites on my account, and you are right; there is no pattern of why it's happening. I found only one Atomic site in this case with missing options property.
I'll investigate further.