We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8e571e8 + d18276e commit c6934edCopy full SHA for c6934ed
src/components/CodeEmbed/index.jsx
@@ -67,10 +67,12 @@ export const CodeEmbed = (props) => {
67
setRendered(true);
68
69
// Includes p5.min.js script to be used by `CodeFrame` iframe(s)
70
- const p5ScriptElement = document.createElement("script");
71
- p5ScriptElement.id = "p5ScriptTag";
72
- p5ScriptElement.src = cdnLibraryUrl;
73
- document.head.appendChild(p5ScriptElement);
+ if (!document.getElementById("p5ScriptTag")) {
+ const p5ScriptElement = document.createElement("script");
+ p5ScriptElement.id = "p5ScriptTag";
+ p5ScriptElement.src = cdnLibraryUrl;
74
+ document.head.appendChild(p5ScriptElement);
75
+ }
76
}, []);
77
78
if (!rendered) return <div className="code-placeholder" />;
0 commit comments