From 7dafe17f755325e08e1f16889e4b9520110ec19a Mon Sep 17 00:00:00 2001 From: bryanhoffman Date: Fri, 6 Feb 2026 15:40:58 -0600 Subject: [PATCH 1/2] Added p5.min.js in such a way that it prevents a race condition on the example /advanced-canvas-rendering-multiple-canvases Signed-off-by: Bryan Hoffman --- src/components/CodeEmbed/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CodeEmbed/index.jsx b/src/components/CodeEmbed/index.jsx index d0b39fe557..bbdc716bbf 100644 --- a/src/components/CodeEmbed/index.jsx +++ b/src/components/CodeEmbed/index.jsx @@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "preact/hooks"; import { useLiveRegion } from '../hooks/useLiveRegion'; import CodeMirror, { EditorView } from "@uiw/react-codemirror"; import { javascript } from "@codemirror/lang-javascript"; -import { cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals"; +import { minifiedLibraryDownloadUrl, cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals"; import { CodeFrame } from "./frame"; import { CopyCodeButton } from "../CopyCodeButton"; @@ -96,7 +96,7 @@ export const CodeEmbed = (props) => { base={props.base} frameRef={codeFrameRef} lazyLoad={props.lazyLoad} - scripts={props.includeSound ? [cdnSoundUrl] : []} + scripts={props.includeSound ? [minifiedLibraryDownloadUrl, cdnSoundUrl] :[minifiedLibraryDownloadUrl]} />
From f416649ebb16aeab24237f7d397edda9ea338c5e Mon Sep 17 00:00:00 2001 From: bryanhoffman Date: Fri, 6 Feb 2026 17:15:24 -0600 Subject: [PATCH 2/2] Corrected myself, cdnLibraryUrl was already present, so we'll just use that instead of Github's p5.min.js. Passing it into code.scripts in index.jsx rather than frame.tsx resolve the issue with the Multiple Canvases example. Signed-off-by: Bryan Hoffman -${((code.scripts?.length ?? 0) > 0 ? [cdnLibraryUrl, ...(code.scripts ?? [])] : []).map((src) => ``).join('\n')} +${((code.scripts?.length ?? 0) > 0 ? [(code.scripts ?? [])] : []).map((src) => ``).join('\n')} ${code.htmlBody || ""} ${(code.scripts?.length ?? 0) > 0 ? '' : ` diff --git a/src/components/CodeEmbed/index.jsx b/src/components/CodeEmbed/index.jsx index bbdc716bbf..5c5b31b528 100644 --- a/src/components/CodeEmbed/index.jsx +++ b/src/components/CodeEmbed/index.jsx @@ -2,7 +2,7 @@ import { useState, useEffect, useRef } from "preact/hooks"; import { useLiveRegion } from '../hooks/useLiveRegion'; import CodeMirror, { EditorView } from "@uiw/react-codemirror"; import { javascript } from "@codemirror/lang-javascript"; -import { minifiedLibraryDownloadUrl, cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals"; +import { cdnLibraryUrl, cdnSoundUrl } from "@/src/globals/globals"; import { CodeFrame } from "./frame"; import { CopyCodeButton } from "../CopyCodeButton"; @@ -96,7 +96,7 @@ export const CodeEmbed = (props) => { base={props.base} frameRef={codeFrameRef} lazyLoad={props.lazyLoad} - scripts={props.includeSound ? [minifiedLibraryDownloadUrl, cdnSoundUrl] :[minifiedLibraryDownloadUrl]} + scripts={props.includeSound ? [cdnLibraryUrl, cdnSoundUrl] :[cdnLibraryUrl]} />