lbry-desktop/web/component
infinite-persistence 15bd26399f Handle case where ad-cleanup fails
## 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.
2022-03-09 08:47:13 -05:00
..
ads Handle case where ad-cleanup fails 2022-03-09 08:47:13 -05:00
browserNotificationBanner Add initialization status to push notification hook. Can be used to better control render strategy in cmpnts utilizing it. (#284) 2021-11-12 12:06:07 -05:00
browserNotificationHints Add hints if an error occurs subscribing to notifications (#143) 2021-11-01 14:51:23 -04:00
browserNotificationSettings useBrowserNotifications: don't set state if already unmounted. 2022-03-09 13:22:54 +08:00
fileViewerEmbeddedEnded Desktop cherry-pick: "7240 Integrate lbry redux and lbryinc" 2021-10-19 20:40:07 +08:00
openInAppLink add user + rewards redux code from lbryinc 2020-06-16 09:56:32 -04:00
youtubeReferralWelcome add user + rewards redux code from lbryinc 2020-06-16 09:56:32 -04:00
footer.jsx change the way checking if onetrust is available 2021-12-14 15:09:31 -05:00
meme.jsx meme component2 2021-07-23 14:56:42 -04:00
nag-data-collection.jsx Odysee specific changes and other misc improvements (#219) 2021-11-03 15:47:19 -04:00
nag-degraded-performance.jsx More cleanup 2022-01-31 11:39:03 -05:00
nag-no-user.jsx NagNoUser i18n update 2021-12-30 20:42:53 +08:00
nag-sunset.jsx Localize sunset nag 2021-09-23 20:19:23 +08:00