Update assets/js/components/diagram.js

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
pull/6079/head
Jason Stirnaman 2025-06-03 10:11:38 -05:00 committed by Jason Stirnaman
parent d184f45434
commit f908bab51f
1 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,12 @@
// Memoize the mermaid module import
let mermaidPromise = null;
export default function Diagram({ component }) { export default function Diagram({ component }) {
// Import mermaid.js module // Import mermaid.js module (memoized)
import('mermaid').then(({ default: mermaid }) => { if (!mermaidPromise) {
mermaidPromise = import('mermaid');
}
mermaidPromise.then(({ default: mermaid }) => {
// Configure mermaid with InfluxData theming // Configure mermaid with InfluxData theming
mermaid.initialize({ mermaid.initialize({
startOnLoad: false, // We'll manually call run() startOnLoad: false, // We'll manually call run()