Fix display ad event race condition (#19326)

* Mitigate race condition for async loaded billboard

* Put observeDisplayAds in billboard.js
This commit is contained in:
Ben Halpern 2023-04-13 18:30:46 -04:00 committed by GitHub
parent 940c67a904
commit 51a2292fbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,11 @@ async function generateDisplayAd(element) {
element.innerHTML = '';
element.appendChild(generatedElement);
setupDisplayAdDropdown();
// This is called here because the ad is loaded asynchronously.
// The original code is still in the asset pipeline, so is not importable.
// This could be refactored to be importable as we continue that migration.
// eslint-disable-next-line no-undef
observeDisplayAds();
}
}