fix: address Sentry performance and runtime issues#15999
Merged
Conversation
- Fix DOCS-A0W: Remove mdx-bundler from serverExternalPackages to fix ESM require() error - Fix DOCS-8BT: Lazy-load Search and MobileMenu components to reduce initial JS bundle - Fix DOCS-7KN: Load Radix CSS asynchronously to prevent render-blocking - Optimize Kapa AI script loading with lazyOnload strategy - Add font display swap for better text rendering Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The dynamic CSS import approach doesn't work - CSS imports are processed at build time by webpack, not runtime. Reverting to standard static import. DOCS-7KN (render-blocking CSS) remains unfixed - would require architectural changes like switching from @radix-ui/themes to unstyled primitives. Co-Authored-By: Claude <noreply@anthropic.com>
rahulchhabria
approved these changes
Jan 14, 2026
| </ThemeProvider> | ||
| <Script | ||
| async | ||
| strategy="lazyOnload" |
Contributor
There was a problem hiding this comment.
LazyOnload strategy breaks askAI URL parameter feature
Medium Severity
Changing the Kapa AI script from async to strategy="lazyOnload" breaks the ?askAI=true URL parameter functionality. The AskAiSearchParams component in src/components/askAiSearchParams.tsx uses a 300ms timeout to wait for the Kapa script to load before opening the AI modal. With lazyOnload, the script doesn't start loading until after the page is fully loaded and the browser becomes idle—which typically exceeds 300ms—so window.Kapa?.open will be undefined when the timeout fires, and the modal will never open.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Addresses top Sentry issues in the docs project:
require()error with mdx-bundlerChanges
DOCS-A0W: mdx-bundler ESM error
Removed
mdx-bundlerfromserverExternalPackagesin next.config.ts. The package is ESM-only ("type": "module") and cannot berequire()d at runtime on Vercel. TheoutputFileTracingExcludesalready handles excluding heavy build-time parts.DOCS-8BT: Large render-blocking JS
Searchcomponent (includes Algolia + global-search) usingnext/dynamicMobileMenucomponent (only needed on mobile)strategy="lazyOnload"DOCS-7KN: Large render-blocking CSS
@radix-ui/themes/styles.css(26K lines) asynchronously via newRadixStylescomponentdisplay: 'swap'to font configurationTrade-offs
Testing
Please verify: