-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix: Fix code block hydration errors #11046
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will decrease total bundle size by 16.29kB ⬇️
|
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.
Generally, I wouldn't mind if we merged in this state. However, can we leave a few extra comments explaining wtf is going on with the lazy loading stuff?
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.
Thanks for removing this. I think I missed this file in the changelog migration.
__html: JSON.stringify( | ||
api.responses[selectedResponse].content?.schema, | ||
null, | ||
2 |
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.
Is there any way uncontrolled input can land here?
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.
good point, but no, this is just the filtered response of our openAPI call
@@ -25,29 +29,39 @@ function Example({api, selectedTabView, selectedResponse}: ExampleProps) { | |||
exampleJson = api.responses[selectedResponse].content?.example; | |||
} | |||
|
|||
// load prism dynamically for these codeblocks, | |||
// otherwise the highlighting applies globally | |||
useEffect(() => { |
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.
Will this cause layout shift or flashing because it paints some time after the initial page load? 🤔
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.
Yes, but it did that before as well. We could also think about not dynamically loading prismjs at all and instead use what we already have (rehypePrismPlus). This would streamline the style of the API JSON examples with our other codeblocks. This would require more work though, we can do it in another pr if needed.
Feel free to merge! |
ApiExamples
componentfixes #10574
might fix errors for switching code tabs (#10719)