Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions apps/web/src/components/ChatMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/chat/MessagesTimeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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>
);
Expand Down
Loading