-
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
Fix removeAdUnit #4053
Fix removeAdUnit #4053
Conversation
When there are multiple adUnits with the same code, only one of them gets removed. This fixes that.
All tests pass but CircleCI keeps returning timeouts :-/ |
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.
I've reviewed and the code looks ok, but I'm unable to get the circleci tests to pass.
Can you try updating your branch with the latest from Prebid.js master, it may fix to the circleci failure.
@idettman The branch has been updated with master and there's still a timeout error. |
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.
LGTM
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.
This is a bug. The original code should work except they're iterating over the object they're mutating. Your solution probably works but changes functionality a little bit (creates a new array reference). I'd rather the bug was fixed without changing the exposed API (even if slight, it has potential to break things).
In this case, the fix would be to iterate over the adUnit array backwards.
Nice catch @snapwich, so would the fix be something like this?
|
@idettman should be |
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.
LGTM
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.
LGTM
* Fix removeAdUnit When there are multiple adUnits with the same code, only one of them gets removed. This fixes that. * snapwich fix
Type of change
Description of change
When there are multiple adUnits with the same code, only one of them gets removed. This fixes that.