Skip to content

fix: request detail preview in dark mode#1666

Merged
looplj merged 1 commit into
unstablefrom
dev-tmp
May 14, 2026
Merged

fix: request detail preview in dark mode#1666
looplj merged 1 commit into
unstablefrom
dev-tmp

Conversation

@looplj

@looplj looplj commented May 14, 2026

Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ReasoningContent and Response components to include a shikiTheme prop for the Streamdown component. Feedback suggests avoiding the spread of unrelated props to Streamdown in ReasoningContent to prevent React warnings and potential DOM attribute issues. Additionally, it is recommended to extract the shikiTheme array into a shared constant to avoid duplication and prevent unnecessary re-renders caused by inline array definitions in memoized components.

{...props}
>
<Streamdown {...props}>{children}</Streamdown>
<Streamdown shikiTheme={['one-light', 'one-dark-pro']} {...props}>{children}</Streamdown>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Spreading props onto the Streamdown component is problematic here because props contains properties intended for CollapsibleContent (such as forceMount or asChild). Passing these unrelated props to Streamdown can lead to React warnings about invalid DOM attributes or unexpected behavior. Additionally, the shikiTheme array is defined inline within a memoized component, which creates a new reference on every render and can bypass memoization optimizations. Consider extracting the theme array to a constant.

Suggested change
<Streamdown shikiTheme={['one-light', 'one-dark-pro']} {...props}>{children}</Streamdown>
<Streamdown shikiTheme={['one-light', 'one-dark-pro']}>{children}</Streamdown>

export const Response = memo(
({ className, ...props }: ResponseProps) => (
<Streamdown className={cn('size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0', className)} {...props} />
<Streamdown className={cn('size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0', className)} shikiTheme={['one-light', 'one-dark-pro']} {...props} />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The shikiTheme configuration ['one-light', 'one-dark-pro'] is duplicated here and in reasoning.tsx. To improve maintainability and ensure consistency across the application, consider extracting this to a shared constant. Furthermore, defining the array inline in a memoized component creates a new reference on every render, which may cause unnecessary re-renders of the Streamdown component if it performs shallow prop comparisons.

@greptile-apps

greptile-apps Bot commented May 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes syntax highlighting in dark mode by passing shikiTheme={['one-light', 'one-dark-pro']} to the Streamdown component in both the Response and ReasoningContent components, replacing the library's default ['github-light', 'github-dark'] pair.

  • response.tsx: shikiTheme is appended before {...props}, so callers can still override it since ResponseProps is ComponentProps<typeof Streamdown> and includes shikiTheme.
  • reasoning.tsx: shikiTheme is also placed before {...props}, but ReasoningContentProps extends ComponentProps<typeof CollapsibleContent> (not Streamdown), so shikiTheme is not part of the public API of ReasoningContent and cannot be overridden by callers at the type level.

Confidence Score: 5/5

Safe to merge — the change is a one-prop addition to two leaf components with no side effects beyond visual appearance.

Both files receive a single well-typed prop addition. The theme strings are valid Shiki bundle themes. The Response component correctly allows callers to override the theme via spread props. In ReasoningContent the theme is not overridable from the outside, but that is a minor limitation rather than a defect.

No files require special attention.

Important Files Changed

Filename Overview
frontend/src/components/ai-elements/response.tsx Adds shikiTheme={['one-light', 'one-dark-pro']} to Streamdown to enable dark-mode-aware syntax highlighting; straightforward and correct change.
frontend/src/components/ai-elements/reasoning.tsx Adds shikiTheme to Streamdown inside ReasoningContent; props from CollapsibleContent are spread into Streamdown (pre-existing), but the new prop ordering means a caller-supplied shikiTheme would be ignored because the prop isn't in ReasoningContentProps.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Browser detects color-scheme] --> B{Light or Dark?}
    B -- Light --> C[Shiki applies 'one-light' theme]
    B -- Dark --> D[Shiki applies 'one-dark-pro' theme]
    C --> E[Streamdown renders code blocks]
    D --> E
    E --> F[Response component]
    E --> G[ReasoningContent component]
Loading

Reviews (1): Last reviewed commit: "fix: request detail preview in dark mode" | Re-trigger Greptile

@looplj looplj merged commit 1694d32 into unstable May 14, 2026
4 checks passed
looplj added a commit that referenced this pull request May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant