[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Akita crashes IE11 with error Object doesn't support property or method 'includes'. Using the basic includes polyfill would be an easy way to solve this.
The error occurs on line 78 of the entityStore.ts file.
https://github.com/datorama/akita/blob/b72828e185492b3b843074ce625421fb283497ce/akita/src/entityStore.ts#L78
Able to load my web application running Akita 3.0 in IE11
Create React App 2.1.8
React 16.8.4
Internet Explorer 11
There is a reason you don't load a polyfill?
I was able to place a polyfill in my index.tsx but it's still annoying that I need to do this because Akita doesn't include it. I am not using includes anywhere in my code.
if (!String.prototype.includes) {
Object.defineProperty(String.prototype, 'includes', {
value: function(search: string, start: number) {
if (typeof start !== 'number') {
start = 0
}
if (start + search.length > this.length) {
return false
} else {
return this.indexOf(search, start) !== -1
}
},
})
}
if (!Array.prototype.includes) {
Object.defineProperty(Array.prototype, 'includes', {
value: function(valueToFind: any, fromIndex: number) {
if (this == null) {
throw new TypeError('"this" is null or not defined');
}
const o = Object(this);
// tslint:disable-next-line:no-bitwise
const len = o.length >>> 0;
if (len === 0) {
return false;
}
// tslint:disable-next-line:no-bitwise
const n = fromIndex | 0;
let k = Math.max(n >= 0 ? n : len - Math.abs(n), 0);
function sameValueZero(x: number, y: number) {
return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y));
}
while (k < len) {
if (sameValueZero(o[k], valueToFind)) {
return true;
}
k++;
}
return false;
}
});
}
@hanneswidrig but this way everyone can decide which polyfills are needed for the support requirements in their project
if someone does not need to support IE, why should they provide the polyfill?
I think like @twittwer, but we need to add a section about it in our documentation and include this polyfill for people to add if they need it. What do you think, @hanneswidrig?
Many developers don't support IE11 or already including something like https://github.com/zloirock/core-js
@NetanelBasal I think a note in documentation listing out the browser requirements would be advisable. That way anyone that has to support IE11 馃槶 , will know they need to provide the polyfills themselves.