Repository navigation
fix: refrain from using prismjs for syntax highlighting on older browsers - #2480
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Warning Rate limit exceeded@ranst91 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 44 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
WalkthroughReplaces a static Prism import in CodeBlock.tsx with a runtime selection that picks Prism if RegExp lookbehind is supported, otherwise falls back to Light. No public API, rendering behavior, or exported signatures were changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as CodeBlock (render)
participant M as useMemo
participant E as Env (RegExp)
participant P as Prism Highlighter
participant L as Light Highlighter
U->>M: compute SyntaxHighlighter
M->>E: test RegExp lookbehind support
alt lookbehind supported
M-->>U: select Prism
U->>P: render(code, language)
else not supported
M-->>U: select Light
U->>L: render(code, language)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx (1)
2-2: Avoid eagerly bundling both Prism and Light; code‑split the fallback.Importing both engines increases bundle size even when one is unused. Prefer lazy loading the chosen engine.
Example (non-blocking):
// at top-level const PrismHighlighter = React.lazy(() => import("react-syntax-highlighter").then((m) => ({ default: m.Prism })), ); const LightHighlighter = React.lazy(() => import("react-syntax-highlighter").then((m) => ({ default: m.Light })), ); // then render with <Suspense> and pick one after mount similar to your detection.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
CopilotKit/packages/react-ui/**
📄 CodeRabbit inference engine (.cursor/rules/copilotkit-architecture.mdc)
UI components for copilot interfaces should be placed in CopilotKit/packages/react-ui/
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Use TypeScript for better type safety
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
{**/*.{ts,tsx},CopilotKit/utilities/tailwind-config/**}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
Maintain consistent styling with Tailwind CSS
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
{CopilotKit/packages/react-ui/**/*.{ts,tsx},examples/**/ui/**/*.{ts,tsx}}
📄 CodeRabbit inference engine (.cursor/rules/frontend-development.mdc)
{CopilotKit/packages/react-ui/**/*.{ts,tsx},examples/**/ui/**/*.{ts,tsx}}: Implement responsive design
Provide clear user feedback
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
CopilotKit/packages/react-ui/**/*
📄 CodeRabbit inference engine (.cursor/rules/quick-reference.mdc)
Add [react-ui/] for pre-built components when building a simple Copilot or customizing UI components
Files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
🧠 Learnings (1)
📚 Learning: 2025-07-20T15:40:00.391Z
Learnt from: CR
PR: CopilotKit/CopilotKit#0
File: .cursor/rules/suggestions-development.mdc:0-0
Timestamp: 2025-07-20T15:40:00.391Z
Learning: Applies to packages/react-ui/src/hooks/use-copilot-chat-suggestions.tsx : Check useEffect dependencies and ensure they're properly memoized to avoid infinite re-renders
Applied to files:
CopilotKit/packages/react-ui/src/components/chat/CodeBlock.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
- GitHub Check: Build Images (next-openai, next-openai)
- GitHub Check: Build Images (coagents-qa-native, agent, python, local-deps)
- GitHub Check: Build Images (coagents-qa-native, ui)
- GitHub Check: Build Images (coagents-qa-text, ui)
- GitHub Check: Build Images (coagents-qa-text, agent, python, local-deps)
- GitHub Check: Build Images (coagents-routing, ui)
- GitHub Check: Build Images (coagents-research-canvas, ui)
- GitHub Check: Build Images (coagents-routing, agent, python, local-deps)
- GitHub Check: Build Images (coagents-research-canvas, agent, python, local-deps)
- GitHub Check: E2E Tests
- GitHub Check: Test (20.x)
- GitHub Check: Test (18.x)
fc6fa47 to
ff13fcb
Compare
Test ResultsStatus: ✅ Passed (View Run) Commit: dce6525 Duration: 249.3s Total Tests: 37 Pass Rate: 100.0% Failed Tests: 0 🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
🦋 Changeset detectedLatest commit: a421148 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Click here if you're a maintainer who wants to add another changeset to this PR |
PreviewsCommit SHA: 18cf2d7
|
Older browsers might not support "lookback assertions", which are using in the code block in prismjs.
if these are not supported, we will default to an engine that does not use this assertion
Summary by CodeRabbit
Bug Fixes
Refactor