This bug in the polyfill impacts React 16 users, and we are shipping React 16 very soon.
Specifically, Map.prototype.forEach attempts to skip deleted items but then always calls the callback. The problem is that it may be the case that all items were deleted, in which case it should have skipped the callback. In other words, this check should be done just before calling the callback as well.
Specific reproducing case:
var x = new Map();
x.set(42, 'hi');
x.delete(42);
x.forEach(function() {
throw new Error('Should never get here!');
});
This breaks with the provided Map polyfill but works with the native implementation.
Thanks for the issue @gaearon, I really appreciate the reproducible test case!
Could this fix be in 3.21.1 instead of 3.22 ?
It is really a major fix for Map that I searched for a couple days because Map was totally broken in IE11 and make the usage of library like https://github.com/bendc/animateplus totally impossible
If all goes well, we will be looking to release 3.22 next week
Is there a link for the hosted version of v3.22?, i.e. now I am using https://cdn.polyfill.io/v2/polyfill.min.js, which as far as I understand is v2.
Never mind. I am wrong. Just checked https://cdn.polyfill.io/v2/polyfill.js. It is actually v3.20.2.
@gajus It will be on https://qa.polyfill.io/v2/docs/ sometime this week, we will announe this as a github prerelease and tweet about it.
Any news on this @JakeChampion ? Still blocked on polyfill-service deploiement because of this critical Map issue :/
It is on qa now for testing -- https://github.com/Financial-Times/polyfill-service/releases/tag/v3.22.0-0
:+1:
React 16 was released yesterday and relies on this fix to work.
@gaearon Understood, we have a standard roll out plan for this service which is to have the next release go on qa.polyfill.io for our users to test with and after 7 days, if no issues are reported we promote to production.
Yeah, I didn鈥檛 meant to be pushing :-). Just letting you know.
@JakeChampion - any update on if there were any issues discovered in QA?
@green-arrow 3.22 was shipped with the fix
Most helpful comment
@green-arrow 3.22 was shipped with the fix