Why does zoid.destroy() throw an error when it destroys components?
See original GitHub issueI need to create a react zoid component during the render phase, based on some props where we don’t know the tag or url ahead of time. My component looks like this;
export const ZoidComponent = ({ tag, url, ...props }) => {
const Zoid = useMemo(() => {
zoid.destroy()
return zoid.create({ tag, url }).driver("react", { React, ReactDOM })
}, [tag, url])
return Zoid ? <Zoid {...props} /> : null;
}
The component above works fine and as expected, however, there’s a niggly Uncaught Error: zoid destroyed all
. I destroy before creating because if I don’t, I get the error Can not register multiple components with the same tag
.
Why does it throw this error if it destroyed it successfully?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
"Error: zoid destroyed all components " error in reactjs nextjs
My solution is load the PayPal script before run create button script function loadAsync(url: string, callback: () => void) { const s ...
Read more >Error: zoid destroyed all components " error in reactjs nextjs ...
Currently, there is an open PR that has not yet been completed/approved, but is on the way to solve this issue.
Read more >krakenjs - Bountysource
But if the user opens the modal and quickly closes it, (seemingly, before the zoid iframe finished loading), then the following uncaught error...
Read more >zoid - UNPKG
The CDN for zoid. ... src/component/component.js","webpack://zoid/. ... (!host) {\n throw new Error(`Can not read window host`);\n }\n\n return `${ protocol ...
Read more >Multiple currencies support in paypal smart Button
The console throwing error Uncaught Error: Zoid destroyed all components on every switch of a radio button. Any tip or suggestion is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @bluepnume
So, how could we update the URL of the Zoid-component that was created with a specific URL? I mean, it’s possible to update the URL of the component used in the
create
function from Zoid?Fair enough 😃
That’s why I suggested setting
url
as a function though. Based on the props passed, you can generate totally different urls.