pauldijou / redux-act

An opinionated lib to create actions and reducers for Redux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

redux-act does not work in IE 11 without polyfills

dzzzchhh opened this issue · comments

commented

Hi everyone!

I have an issue with running redux-act in IE11 without polyfillis, since it has no support for String.startsWith method.

I was wondering if some of the inner functions can implemented in a way that older browsers would not have issues running the library, and if so, I would gladly participate in resolving this issue.

Thanks in advance.

Hi,

This is still a problem for me with version 1.7.3. Specifically, IE11 is bombing in createReducer.js on the line: if (action.type.startsWith('@@redux/')) {. It's unclear from the this and related issues whether this problem is fixed internal to the library, or whether I need to explicitly include a polyfill for startsWith.

Thanks!

commented

@bmueller-sykes when i was testing different cases for polyfilling IE 11, i found out that you need to polyfill startsWith in order to get redux-act to work with IE 11.

Understood, but given that this ticket was closed, I don't know if that means that this library should now include a startsWith dependency, and therefore we wouldn't have to expressly do it in our app. It seems to me as though this package should include a startsWith polyfill, since this package won't work in IE11 without it.

commented

TLDR: redux-act does not have a polyfill for startsWith, you have to provide one yourself.
@bmueller-sykes i submitted PR some time ago, but it was declined after a brief chat with the library author, since redux-act is a pattern-helper, not a ui library that has to include all sorts of legacy dependencies.

huh. okay, I guess.

I think I put the wrong issue number in my previous comment, I edited it.

So yeah, just as said, it wasn't close because anything was fixed but because a decision was made. startsWith is a JavaScript API like any other, years old now, you should polyfill it if you are targeting browser which do not support it. You should not expect libs to polyfill everything up to your own target.

Also, it's written in bold in the README:

Browser support: this lib uses String.prototype.startsWith which is not supported by IE11. Be sure to add a polyfill if you are targeting this browser. Learn more.

I totally just got RTFM'ed first thing in the morning. (-;

Thanks much for the reply!