redux-form: CreateReducer.js uses "startsWith" which is unsupported in IE11
Are you submitting a bug report or a feature request?
bug report
What is the current behavior?
Unable to input text into Redux Form Field in IE11. Results in “TypeError: Object doesn’t support property or method ‘startsWith’”
What is the expected behavior?
It should be possible to input text without throwing any errors in IE11.
What’s your environment?
redux-form 7.4.2 IE11
Other information
Line causing the error: https://github.com/erikras/redux-form/blob/v7.4.2/src/createReducer.js#L47
if (path.startsWith('values')) {
Commit that introduced the error: https://github.com/erikras/redux-form/commit/a97606fee0ed365903fff80cc93956fe2313a3ce
String.prototype.startsWith()
browser support:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
We’ve been able to work around this by using core-js to polyfill the feature.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 16 (1 by maintainers)
This issue is marked as
closed
, but it persists because https://github.com/erikras/redux-form/pull/4128 has been merged into master, but not released yet. Any idea when this is going to be released? Thanks very much!@erikras @gustavohenke any update on this?
@erikras We need a release to fix this bug please
import 'core-js/modules/es6.string.starts-with'; // redux-form
in the beginning of your appAdding polyfills to Redux Form wouldn’t be a good idea, but if you mean using its implementation, then yeah, that’s an option.
An even better one would be to use a regular expression, like
/^values/.test(path)
, as then others don’t need to guess where the magic number of the.substr()
call is coming from.