-
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
Avoid getTheme call when slug is null #95570
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
previewingThemeSlug, | ||
previewingThemeName: undefined, | ||
}; | ||
} |
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.
Using both approaches to be a little more defensive with this hook, only one is technically needed.
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! Could you add the Lego Maintenance label?
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.
Tested and works as expected 👍
Related to # p55Cj4-3EI-p2
Proposed Changes
Prevents unnecessary call to wp/v2/sites/:site/themes
Why are these changes being made?
When there is no theme being previewed and theme slug was undefined the
getTheme
call was makes a fallback call to get all themes instead of just the one theme. This call takes 10s on dotcom and was blocking the site editor from rendering.Testing Instructions
Confirm only one theme call is made on site editor load:
yarn dev --sync
orinstall-plugin.sh wpcom-block-editor update/themes-preview
Also confirm live preview still renders correctly:
Before
After