Skip to content

Commit 66970a3

Browse files
Merge pull request #47 from OpenZeppelin/fix/wizard-loading
fix: fixed issue with wizard not loading after page switch
2 parents 42001d3 + 0da720c commit 66970a3

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

src/components/oz-wizard.tsx

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,17 @@ interface OZWizardProps {
2626
version?: string;
2727
}
2828

29-
// Global flag to prevent multiple script loads
30-
let wizardScriptLoaded = false;
31-
3229
function OZWizardComponent({ tab, lang, version }: OZWizardProps) {
3330
const wizardRef = useRef<HTMLElement>(null);
3431

3532
useEffect(() => {
36-
if (!wizardScriptLoaded) {
37-
// Check if script is already in DOM
38-
const existingScript = document.querySelector(
39-
'script[src="https://wizard.openzeppelin.com/build/embed.js"]',
40-
);
41-
42-
if (!existingScript) {
43-
wizardScriptLoaded = true;
33+
// Dynamically load the wizard script
34+
const script = document.createElement("script");
35+
script.src = "https://wizard.openzeppelin.com/build/embed.js";
36+
script.async = true;
4437

45-
// Dynamically load the wizard script
46-
const script = document.createElement("script");
47-
script.src = "https://wizard.openzeppelin.com/build/embed.js";
48-
script.async = true;
49-
50-
// Add script to head
51-
document.head.appendChild(script);
52-
}
53-
}
38+
// Add script to head
39+
document.head.appendChild(script);
5440
}, []);
5541

5642
return (

0 commit comments

Comments
 (0)