-
-
Notifications
You must be signed in to change notification settings - Fork 3.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(react-live-dynamic): reduces 32.2% size of the docs website #4451
docs(react-live-dynamic): reduces 32.2% size of the docs website #4451
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui/HxHBMXHFetpSNvLScnKBoSSR7EiB |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit ccff167:
|
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 an impressive amount of improvement for how little change is required. Thanks so much!
|
||
function CodeBlock(props) { | ||
const [isMounted, { on }] = useBoolean() |
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.
TIL, again! I forgot this was even a thing 🤦
if (render) { | ||
if (isMounted && render) { | ||
/** | ||
* @TODO Not sure if this is even used? |
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 don't think it is either
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.
Yeah I seems cannot find the source of it from the MDX docs
📝 Description
Per page size reduction: 785kB -> 532kB. Reduced 32.2% of the initial bytes.
⛳️ Current behavior (updates)
The current
<CodeBlock />
importsreact-live
everywhere. Even for those pages that are not even using the live-editor feature (live=true
).🚀 New behavior
Refactor
<CodeBlock />
and make the live-editor parts loadable vianext/dynamic
.💣 Is this a breaking change (Yes/No):
No
📝 Additional Information
The loadable information by
Nextjs
: