Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

Fix markdown highlight render stability (#2479)

cursor[bot]623e471a0230
diff --git a/apps/web/src/components/ChatMarkdown.tsx b/apps/web/src/components/ChatMarkdown.tsx
index 4b53f8534..5d9fcea50 100644
--- a/apps/web/src/components/ChatMarkdown.tsx
+++ b/apps/web/src/components/ChatMarkdown.tsx
@@ -211,6 +211,32 @@ function SuspenseShikiCodeBlock({
);
}
+ return (
+ <UncachedShikiCodeBlock
+ code={code}
+ language={language}
+ themeName={themeName}
+ cacheKey={cacheKey}
+ isStreaming={isStreaming}
+ />
+ );
+}
+
+interface UncachedShikiCodeBlockProps {
+ code: string;
+ language: string;
+ themeName: DiffThemeName;
+ cacheKey: string;
+ isStreaming: boolean;
+}
+
+function UncachedShikiCodeBlock({
+ code,
+ language,
+ themeName,
+ cacheKey,
+ isStreaming,
+}: UncachedShikiCodeBlockProps) {
const highlighter = use(getHighlighterPromise(language));
const highlightedHtml = useMemo(() => {
try {
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index e4b683592..f34c2a56e 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -87,6 +87,8 @@ interface TimelineRowSharedState {
}
const TimelineRowCtx = createContext<TimelineRowSharedState>(null!);
+const TIMELINE_LIST_HEADER = <div className="h-3 sm:h-4" />;
+const TIMELINE_LIST_FOOTER = <div className="h-3 sm:h-4" />;
// ---------------------------------------------------------------------------
// Props (public API)
@@ -261,8 +263,8 @@ export const MessagesTimeline = memo(function MessagesTimeline({
maintainVisibleContentPosition
onScroll={handleScroll}
className="h-full overflow-x-hidden overscroll-y-contain px-3 sm:px-5"
- ListHeaderComponent={<div className="h-3 sm:h-4" />}
- ListFooterComponent={<div className="h-3 sm:h-4" />}
+ ListHeaderComponent={TIMELINE_LIST_HEADER}
+ ListFooterComponent={TIMELINE_LIST_FOOTER}
/>
</TimelineRowCtx.Provider>
);