-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[docs-infra] Improve performance hideToolbar: true #37969
[docs-infra] Improve performance hideToolbar: true #37969
Conversation
if (demoOptions.hideToolbar === false) { | ||
throw new Error( | ||
[ | ||
'"hiddenToolbar": false is already the default.', | ||
'"hideToolbar": false is already the default.', | ||
`Please remove the property in {{"demo": "${demoOptions.demo}", …}}.`, |
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.
A typo
{canonicalAs.startsWith('/joy-ui/') ? ( | ||
{productId === 'joy-ui' ? ( |
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.
More resilient logic
<NoSsr defer fallback={<DemoToolbarFallback />}> | ||
<NoSsr fallback={<DemoToolbarFallback />}> |
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.
Extra render useless
}); | ||
setDemoKey(); | ||
}; | ||
const resetDemo = React.useMemo( |
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.
Memoize to avoid rerendering the DemoSandbox on hover.
{/* TODO: BrandingProvider shouldn't be needed, it should already be at the top of the docs page */} | ||
<BrandingProvider {...(demoData.productId === 'joy-ui' ? { mode } : {})}> | ||
{demoOptions.hideToolbar ? null : ( | ||
{demoOptions.hideToolbar ? null : ( |
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.
We can opt-out of a lot more things when demoOptions.hideToolbar
is false.
Netlify deploy previewhttps://deploy-preview-37969--material-ui.netlify.app/ Bundle size report |
ecae19e
to
65294ee
Compare
A quick clean-up on the logic.
This effort is connected to the need to improve the performance of the docs pages. They should render much faster. We are reinforcing the idea that CSS-in-JS or event our components are slow hence you shouldn't use them.