The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 05:00 UTC
Fix markdown highlight render stability (#2479)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
cursor[bot] committed
May 4, 2026 at 09:38 UTC
623e471a0230e9aba289c74a2120bbe91250949a
2 files changed
+30
-2
apps/web/src/components/ChatMarkdown.tsx
+26
@@ -211,6 +211,32 @@ function SuspenseShikiCodeBlock({
211
);
212
}
213
214
+ return (
215
+ <UncachedShikiCodeBlock
216
+ code={code}
217
+ language={language}
218
+ themeName={themeName}
219
+ cacheKey={cacheKey}
220
+ isStreaming={isStreaming}
221
+ />
222
+ );
223
+}
224
+
225
+interface UncachedShikiCodeBlockProps {
226
+ code: string;
227
+ language: string;
228
+ themeName: DiffThemeName;
229
+ cacheKey: string;
230
+ isStreaming: boolean;
231
+}
232
+
233
+function UncachedShikiCodeBlock({
234
+ code,
235
+ language,
236
+ themeName,
237
+ cacheKey,
238
+ isStreaming,
239
+}: UncachedShikiCodeBlockProps) {
240
const highlighter = use(getHighlighterPromise(language));
241
const highlightedHtml = useMemo(() => {
242
try {
apps/web/src/components/chat/MessagesTimeline.tsx
+4
-2
@@ -87,6 +87,8 @@ interface TimelineRowSharedState {
87
}
88
89
const TimelineRowCtx = createContext<TimelineRowSharedState>(null!);
90
+const TIMELINE_LIST_HEADER = <div className="h-3 sm:h-4" />;
91
+const TIMELINE_LIST_FOOTER = <div className="h-3 sm:h-4" />;
92
93
// ---------------------------------------------------------------------------
94
// Props (public API)
@@ -261,8 +263,8 @@ export const MessagesTimeline = memo(function MessagesTimeline({
263
maintainVisibleContentPosition
264
onScroll={handleScroll}
265
className="h-full overflow-x-hidden overscroll-y-contain px-3 sm:px-5"
264
- ListHeaderComponent={<div className="h-3 sm:h-4" />}
265
- ListFooterComponent={<div className="h-3 sm:h-4" />}
266
+ ListHeaderComponent={TIMELINE_LIST_HEADER}
267
+ ListFooterComponent={TIMELINE_LIST_FOOTER}
268
/>
269
</TimelineRowCtx.Provider>
270
);