Skip to content

Commit bbd5be4

Browse files
committed
Revert Mermaid lazy loading to fix E2E tests
The React.lazy approach was causing E2E tests to timeout. While it reduced the main bundle slightly, the benefits don't outweigh the test failures. Keeping the Shiki and tokenizer optimizations which provide the bulk of the bundle size reduction without breaking tests.
1 parent 046df41 commit bbd5be4

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/components/Messages/MarkdownComponents.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
import type { ReactNode } from "react";
2-
import React, { useState, useEffect, Suspense, lazy } from "react";
2+
import React, { useState, useEffect } from "react";
3+
import { Mermaid } from "./Mermaid";
34
import {
45
getShikiHighlighter,
56
mapToShikiLang,
67
SHIKI_THEME,
78
} from "@/utils/highlighting/shikiHighlighter";
89

9-
// Lazy load Mermaid to keep it out of the main bundle
10-
// Dynamic import is intentional for code-splitting
11-
// eslint-disable-next-line no-restricted-syntax
12-
const Mermaid = lazy(() => import("./Mermaid").then((module) => ({ default: module.Mermaid })));
13-
1410
interface CodeProps {
1511
node?: unknown;
1612
inline?: boolean;
@@ -137,11 +133,7 @@ export const markdownComponents = {
137133

138134
// Handle mermaid diagrams specially
139135
if (!isInline && language === "mermaid") {
140-
return (
141-
<Suspense fallback={<div style={{ padding: "1rem" }}>Loading diagram...</div>}>
142-
<Mermaid chart={childString} />
143-
</Suspense>
144-
);
136+
return <Mermaid chart={childString} />;
145137
}
146138

147139
// Code blocks with language - use async Shiki highlighting

0 commit comments

Comments
 (0)