15bd26399f
## Issue Double ads on screen ## Reproduce - Pre re-design: - Change "Only Language" from tne locale nag. - Post re-design: - Follow a bunch of channels with active livestreams. The homepage ad will show 2 ads stack on each other, with second one invisible. Both should be equivalent, just different UI/style. ## Analysis In both cases, it is due to `removeIfExists` failing to remove the element if the ad script hasn't run yet. This can happen when the component is re-mounted immediately after the ad script was added. When the effect-cleanup runs, the script have not started or is running halfway. Aside: The need to run `removeIfExists` further strengthens my hunch that the script is meant to live throughout the lifetime of the app, with it populating the given div as we navigate. But just my guess. ## Approach Clean up before adding the script as well. This covers any missed elements from the previous cleanup. The drawback is that this approach assumes there will only be 1 ad per page, but that's pretty much the case with the existing `removeIfExists` approach. |
||
---|---|---|
.. | ||
index.js | ||
view.jsx |