-
Notifications
You must be signed in to change notification settings - Fork 685
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
[PWA-1110] Investigate render/blocking in Venia (Performance) #2952
Conversation
- No longer block while in loading state
|
Suggest to include an update to workbox. It includes an update to how manifests are loaded GoogleChrome/workbox#2528 which to my reading made the trace more in line with what I expected to load early (in some traces I for example had root components load that were not on the current page before actual images on the page were loaded). |
@fooman |
indeed I am on |
@@ -61,13 +64,13 @@ const LocaleProvider = props => { | |||
} | |||
}; | |||
|
|||
if (loading) return <LoadingIndicator global={true} />; | |||
if (!messages) return <LoadingIndicator global={true} />; |
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 wonder which is better:
a) Showing a loading indicator until fetchLocale
resolves or
b) Not showing a loading indicator, ever, opting to have a potential "flash" when the translated strings come back from fetchLocale
.
It would be really cool if we could read defaultMessage
strings from some bundled file that agencies could customize depending on their own default language...
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.
That's comparing develop.pwa-venia.com to this PR, with this aiming to remove the render blocking of the loading indicator. Rendering the loading indicator means the context isn't getting rendered, including its children (the rest of the app).
The second part you outlined is exactly what this change does; while Apollo is still waiting on its response, we default to english and render the app immediately. If the response comes back and it's the same as the default, nothing re-renders.
I think the ideal solution here is to apply this logic to all stores; we can precache storeConfig
at build time about all stores and immediately load the {StoreConfig.locale} language pack. If we don't want to require rebuilds when config changes, we can leave the query in place that will true up with the network to validate the precached config. I think we've been hinting at needing this solution for awhile, and would be another application to prevent unnecessary re-renders.
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.
@tjwiebell a setting to have storeConfig pre-loaded would be great.
- Add tests for change
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.
Short and sweet. 👍
QA Approved. |
Description
As a developer, I want review and address issues with blockimg/response time (LCP/TBT) to achieve higher Google Lighthouse v6 performance scores as they relate to the shopping experience. This could affect the core code, Webpack and other areas. Analysis from PWA-775 can be found here: https://wiki.corp.magento.com/display/COREENG/Lighthouse+Performance+Audit+-+v8
In-scope
Deep analysis and review of blocking/response using DevTools and other resources. Recommend and remediate issues where needed.
Requirements
Investigate render/blocking with Venia in current state
Identify and remediate (fix) issues as appropriate; possible spike or docs
Testing and validation with Google Lighthouse
Implementation Note
This PR covers a single render blocking point at the very top of the tree added with i18n support. Instead of waiting on the network, the request flow will now cascade in this order:
defaultMessage
props will be rendered at this point.For the happy path of an {{en_US}} store, this means we now immediately render at step 1, and even when step 2/3 completes, nothing in the application needs to re-render. For alternative paths that return a different locale, the app immediately renders with placeholders, and then re-renders with correctly translated strings at step 3. The flash of english strings happens in the application today, this just renders everything much faster.
Followup tickets have been added to the backlog to address the already existing flash of default locale strings; a simple solution being, always rely on build time storeConfig and preload messages while the network request is in flight. If the build time config becomes stale, the app would still recover, while still rendering immediately. We've also discussed rendering actual placeholders (grey boxes like skeleton rendering) instead of defaultMessages.
Related Issue
Acceptance
Verification Stakeholders
Specification
Verification Steps
getLocale
graphql request is no longer render blocking (requests don't wait to fire until it returns)Screenshots / Screen Captures (if appropriate)
Checklist