Skip to content

Commit f908bab

Browse files
jstirnamanCopilot
andcommitted
Update assets/js/components/diagram.js
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent d184f45 commit f908bab

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

assets/js/components/diagram.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
// Memoize the mermaid module import
2+
let mermaidPromise = null;
3+
14
export default function Diagram({ component }) {
2-
// Import mermaid.js module
3-
import('mermaid').then(({ default: mermaid }) => {
5+
// Import mermaid.js module (memoized)
6+
if (!mermaidPromise) {
7+
mermaidPromise = import('mermaid');
8+
}
9+
mermaidPromise.then(({ default: mermaid }) => {
410
// Configure mermaid with InfluxData theming
511
mermaid.initialize({
612
startOnLoad: false, // We'll manually call run()

0 commit comments

Comments
 (0)