washingtonpost / ArcAds

ArcAds is a DFP wrapper created by Arc XP with publishers in mind.
https://www.npmjs.com/package/arcads
MIT License
57 stars 42 forks source link

Prevent ad slot refresh on the first resize event, unless the resize … #83

Closed darimay closed 3 years ago

darimay commented 3 years ago

…was past a breakpoint

On this branch

Details are provided in this issue: https://github.com/washingtonpost/ArcAds/issues/82

Verify

ghost commented 3 years ago

@darimay this will be addressed in the next release

darimay commented 3 years ago

@nealmalkani @nealmalkaniwapo

After testing the new release, we noticed that this change re-arranges the breakpoints by calling the sort() method and hence it breaks the logic we're trying to fix.

The Array.prototype.sort() method sorts the elements (in place) by converting them to strings first.

So [0, 768, 1024] becomes [0, 1024, 768] unfortunately.

Our original PR (https://github.com/washingtonpost/ArcAds/pull/83/files) didn't include sorting the breakpoints because we didn't expect them to be out of order in the first place. However, if you'd like to keep the sorting in place, then we should pass a compareFunction to get around the string conversion.

Thanks