Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

requestBids with empty adUnitCodes requests all slots

Open sinuhepop opened this issue 9 years ago • 5 comments

Type of issue

Bug

Description

When I selectively want to request for some slots, using adUnitCodes property, I expect no request when this array is empty, but all previously registered slots are requested.

pbjs.requestBids({ timeout: 800, adUnitCodes: [], bidsBackHandler: myRefreshAction })

When, instead of an empty array, an array with no valid ids is passed, no requests are made.

sinuhepop avatar Jun 08 '17 12:06 sinuhepop

Not sure why you want no request to be made, but I can see why you'd think it as more consistent that way. Open for discussion.

mkendall07 avatar Jun 14 '17 19:06 mkendall07

Certainly is not a big problem to avoid this, but I thought that can lead to errors when using inadvertently, the same way I did.

sinuhepop avatar Jun 15 '17 14:06 sinuhepop

I'm curious if someone might find this as a "feature" instead of a bug so that they wouldn't have to define what adUnitCodes are on the page

aneuway2 avatar Jun 20 '17 18:06 aneuway2

It works today similar to how DFP googletag.pubads().refresh() works, in that if you don't pass an array of codes all ad units on page will be refreshed, so as such this is working as designed.

protonate avatar Jun 20 '17 20:06 protonate

yeah agree with @protonate. I just documented this to be more clear in the API: https://github.com/prebid/prebid.github.io/commit/f351a6b53174d08e10ef56a8848b4ce1e407c071

mkendall07 avatar Jun 20 '17 20:06 mkendall07