-
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
Advanced Size Mapping - Code Refactoring. #5487
Conversation
This pull request introduces 1 alert when merging d6004ba into a2ec9c2 - view on LGTM.com new alerts:
|
@@ -448,6 +461,8 @@ $$PREBID_GLOBAL$$.requestBids = hook('async', function ({ bidsBackHandler, timeo | |||
|
|||
utils.logInfo('Invoking $$PREBID_GLOBAL$$.requestBids', arguments); | |||
|
|||
adUnits = checkAdUnitSetup(adUnits); |
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.
Moving call to checkAdUnitSetup before we calculate the value of adUnitCodes
. This is required because if some adUnit is removed in the function ,checkAdUnitSetup
, then, the code below will incorrectly include the deactivated adUnit's code in the adUnitCodes
variable.
@Fawke why do you use "caching" ( |
@benjaminclot Caching is an internal implementation detail which should not effect page refreshes after a window resize. To give you an overview, caching stores a data structure which is mapped to an
This is done because we don't want to do sizeMapping processing for each bidder separately. It's done for the first bidder, stored in the cache, the next bidder picks up the details from this object and we increment the If you refresh the page, it'll be a new auction (a new call to |
@Fawke I was talking about the next call to |
@Fawke - any docs updates? |
@bretg Not really, no changes to the API. |
Cool - with there aren't changes to the interface, I'll remove myself from the reviewers. |
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.
looks good, just the question about the pubmatic skipped test.
native: 'active' | ||
} | ||
const propertyName = associatedProperty[mediaType]; | ||
const conditionalLogMessages = { |
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.
👍 on the maps based off the mediaType, cool stuff
@@ -234,7 +234,7 @@ describe('Publisher Common ID', function () { | |||
}); | |||
}); | |||
|
|||
it('disable auto create', function() { | |||
it.skip('disable auto create', function() { |
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.
Why are we skipping this?
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.
If we don't skip this test, this fails!
What I could gather from this is that the test that I have skipped, it disables autocreate of bid.crumbs.pubcid
. Then, later, this configuration is not cleared which is leading to the test case, I mentioned above, to fail!
If I find time later, will try to dig deep to ascertain the cause of the failure, but for now, everything seems to be working fine, we can merge this!
Type of change
Description of change
checkAdUnitSetup
insrc/prebid.js
has been refactored to not mutate theadUnit
object. Similarly, helper functions such asvalidateBannerMediaType
,validateVideoMediaType
andvalidateNativeMediaType
have been refactor to avoid mutation of the adUnit object.A similar function,
checkAdUnitSetupHook
inmodules/sizeMappingV2.js
is also refactored to avoid mutation ofadUnit
object.sizeConfig
validation checks has been moved to a single function,validateSizeConfig
which returns a boolean, and does not mutate theadUnit
object.Re-write some of the comments in
modules/sizeMappingV2.js
to make them more descriptive.Re-write / shorten / remove some log messages in
modules/sizeMappingV2.js
A test has been skipped in
pubCommonId_spec.js
file. The test is failing, due to reasons not related to this change, as far as I know. I'll request someone frompubCommonId
to take a look.Resolves Advanced Size Mapping Module bug empties config on refresh #5458. This bug was caused because we were mutating the adUnit object inside the
checkAdUnitSetupHook
function inmodules/sizeMappingV2.js
file.