Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions src/components/oz-wizard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,17 @@ interface OZWizardProps {
version?: string;
}

// Global flag to prevent multiple script loads
let wizardScriptLoaded = false;

function OZWizardComponent({ tab, lang, version }: OZWizardProps) {
const wizardRef = useRef<HTMLElement>(null);

useEffect(() => {
if (!wizardScriptLoaded) {
// Check if script is already in DOM
const existingScript = document.querySelector(
'script[src="https://wizard.openzeppelin.com/build/embed.js"]',
);

if (!existingScript) {
wizardScriptLoaded = true;
// Dynamically load the wizard script
const script = document.createElement("script");
script.src = "https://wizard.openzeppelin.com/build/embed.js";
script.async = true;

// Dynamically load the wizard script
const script = document.createElement("script");
script.src = "https://wizard.openzeppelin.com/build/embed.js";
script.async = true;

// Add script to head
document.head.appendChild(script);
}
}
// Add script to head
document.head.appendChild(script);
}, []);

return (
Expand Down