Feat/code block cls lower lazy boundary#392
Merged
haydenbleasel merged 4 commits intovercel:mainfrom Feb 18, 2026
Merged
Conversation
Contributor
|
@PaulSenon is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
BeforeEnregistrement.de.l.ecran.2026-02-16.a.13.36.00.movAfterEnregistrement.de.l.ecran.2026-02-16.a.13.36.37.mov |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
awesome, thanks @PaulSenon 🚀 |
Contributor
Author
|
heyy @haydenbleasel sorry to bother, but I think you might have get rid of the older suspense boundary removal. in packages/streamdown/lib/components.tsx - const CodeBlock = lazy(() =>
- import("./code-block").then((mod) => ({ default: mod.CodeBlock }))
- );(and more) |
Contributor
|
ah sorry must have been an issue with the rebase, i'll fix in a new commit. |
haydenbleasel
added a commit
that referenced
this pull request
Feb 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Codeblocks were causing CLS because of spinner fallback on lazyloading the full Codeblock component.
While it makes sense to lazyload the highlighter (heavy) it does not make sense to lazyload all the UI shell.
So now I lowered the lazyload down one level and use the existing codeblock shell as placeholder without highlighting.
Type of Change
Related Issues
Fixes #391
Changes Made
Core commit
Bonus commit
because linter wasn't working according to contribution guidelines, and new linter had small fixable failures. But if this should be another PR let me know and I get rid of this commit
Testing
Just added unit test to make sure we see content before the lazy highlighted-body.tsx resolves but have the highlight callback run only once it loads.
Test Coverage
Screenshots/Demos
before: demo
after: demo
Checklist
pnpm changeset)Changeset
Additional Notes
For full CLS free codeblock we also need to remove the css virtualisation. But this impact render performance so I kept it out of scope. For those who like me want 100% stable render, just add this css:
This will fix an initial scroll to bottom on a chat to be pixel perfect in a layoutEffect. But mind virtualising the chat history if it's big, to compensate de css virtualisation loss.
First time ever contributing to any OSS. Don't be harsh but don't hesitate to tell me if I did something wrong !