schiehll / react-alert

alerts for React
MIT License
607 stars 99 forks source link

Object.values is not a function #124

Closed amillward closed 5 years ago

amillward commented 5 years ago

Hi,

I use react-alert throughout my site, and Sentry is telling me I'm getting many of this error each day; object values

I have not been able to reproduce the error, and I can't see from looking at the code why this would be happening. Anyone else having this issue or can spot what may be going on?

react-alert@5.5.0 react@16.8.6

Thanks

schiehll commented 5 years ago

Hi @amillward!

So you are probably getting this error when someone accesses your site via IE: Screen Shot 2019-08-16 at 10 07 11

I think this was introduced when @besLisbeth added the constants for positions, types, transitions, etc...I could be wrong tho.

You can add a polyfill for it in your site, or maybe we could change it to something like:

Object.keys(positions).map(position => positions[position])

PRs are welcome.

amillward commented 5 years ago

react-alert

That was actually my first guess too, but Sentry is reporting a majority Safari/iPad users... :(

There's a chance Sentry is doing something weird with the error merging? Perhaps it's worth trying the polyfill/fix for IE first and seeing if the issue continues

schiehll commented 5 years ago

Yeah, probably old devices running old versions of browsers...but the solutions stands: You can fix it by adding a polyfill for Object.values to your site, and we can also change the code for something else.

schiehll commented 5 years ago

It's fixed now in v6, thanks for reporting!

ConcealGeek commented 4 years ago

It's fixed now in v6, thanks for reporting!

in v6: https://github.com/schiehll/react-alert/blob/5229d32e4060d4185e3174c63858b2d00e4730b7/src/Provider.js#L125 There's a object.values() here that's forgotten