-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PBjs Core: bugfix - accessing array instead of adUnit #10567
Conversation
src/prebid.js
Outdated
@@ -525,11 +525,11 @@ pbjsInstance.renderAd = hook('async', function (doc, id, options) { | |||
|
|||
// video module | |||
if (FEATURES.VIDEO) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this short-circuit if the bid is not a video bid (bid.mediaType === 'video'
)? to avoid looking up the adUnit - since in 99% of cases this will be used for display and the lookup takes some CPU time.
Also - could you add some tests - verifying that videoModule.renderBid
in invoked when and how you expect it to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgirardi addressed!
7b5b8fa
to
86081d9
Compare
if (FEATURES.VIDEO && bid.mediaType === 'video') { | ||
// TODO: could the video module implement this as a custom renderer, rather than a special case in here? | ||
const adUnit = bid && auctionManager.index.getAdUnit(bid); | ||
const videoModule = getGlobal().videoModule; | ||
if (adUnit?.video && videoModule) { | ||
videoModule.renderBid(adUnit.video.divId, bid); | ||
const divId = adUnit && adUnit.video && adUnit.video.divId; | ||
if (divId && videoModule) { | ||
videoModule.renderBid(divId, bid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgirardi i ported the changes over to direct.js ; open to creating a custom renderer but not sure what you mean by that . Is it an existing pattern ?
@karimMourra assume you see these test errors?
|
fixed in #10819 |
Type of change
Bugfix
Does this change affect user-facing APIs or examples documented on http://prebid.org?
Other
Description of change
pbjsInstance.adUnits.filter
returns an array yet the code was expecting an actual ad unit. This fix usesauctionManager.index.getAdUnit
to get the ad unit and adds a check for thedivId
before attempting to render the ad.Integration example has been updated.
Other information
fixes issue #10505