โ09-27-2022 10:54 AM
Hi I need to reload new card using marqetajs config.
Was trying to rebuild widget :
marqeta.destroy()
the marqeta.bootstrap() again
but getting empty iFrames.
If will reload page working fine with just marqeta.bootstrap();
Is there is a way to reload widget without reloading page?
โ09-27-2022 01:37 PM
Hi!
So it sounds like you are using the correct steps to reload widgets without a page refresh. As you said, you can call marqeta.destroy() to unsubscribe from all events and then you would call marqeta.bootstrap() passing in a config object with a new clientaccesstoken. This should render new iframes with appropriate data without reloading the page.
Have you added a callback for onFailure in the configuration object? This callback gets the error as an argument and could help in debugging. Here is a link to that section in our docs
If you are following the steps with a new clientaccesstoken and are still seeing empty iframes, try adding the callback to see the error and we can debug further from there.
โ09-29-2022 04:38 PM
Hi Eric, didn't worked, still getting same error,
When I'm calling marqeta.destroy()
Marqeta is still in the DOM but iFrames been removed, then I'm building Marqeta config again with a new clientaccesstoken and bootstraping marqeta again
then getting error:
โ10-03-2022 07:29 AM
Ah thanks for the last bit of information. Marqeta.js finds DOM elements using document.getElementById, which would not work for shadow dom elements without a reference to the shadow root unfortunately. I am not sure of your control over your current implementation, but one possibility may be to integrate your target DOM elements via Slots instead? https://developer.mozilla.org/en-US/docs/Web/API/Element/slot