From 7f231e5b3157410b88f7dea4961eb49f20fbadfd Mon Sep 17 00:00:00 2001 From: maxime Da Silva Date: Mon, 19 Oct 2026 16:06:07 +0200 Subject: [PATCH] fix: destroy factory before setting container.innerHTML to '' --- src/Paywall/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Paywall/index.tsx b/src/Paywall/index.tsx index 0c6512d1..cf832302 100644 --- a/src/Paywall/index.tsx +++ b/src/Paywall/index.tsx @@ -117,11 +117,17 @@ const Paywall = forwardRef(({ return; } - container.innerHTML = ''; const factory = paywallRef.current; factory.off('identityAvailable', onIdentityAvailable); paywallRef.current = null; - await destroyFactory?.(factory); + + try { + await destroyFactory?.(factory); + } catch {} + + if (container) { + container.innerHTML = ''; + } }; const recreate = async () => {