Closed GingerFitzgerald closed 6 months ago
I'm not firm with handling google ads might be resolved (dirty) by adding this in GoogleAd.jsx
setGoogleInit(setTimeout(() => {
try {
if (typeof window !== 'undefined')
(window.adsbygoogle = window.adsbygoogle || []).push({});
} catch (e) {
if (!e.message?.includes('All ins elements in the DOM with class=adsbygoogle already have ads in them')) {
console.log(e);
} else {
// set googleInit to 1 to mark that the ads have been loaded
}
}
}, timeout));
not sure if setting googleInit to 1 would be the correct code Remark that the catch does not 'handle' the error for other errors that occur here it just prevents it from stopping the application to run
I've removed the ads block :D
Description
When running the application by npm run dev the google ads add task seems to be executed on each refresh of the page.
To Reproduce
TagError: adsbygoogle.push() error: All ins elements in the DOM with class=adsbygoogle already have ads in them.
Notes
this is seems to only affect dev mode