daniel-lundin / react-dom-confetti

Trigger confetti explosions on state transitions
623 stars 30 forks source link

TypeError exception happening seemingly on IE10+ #4

Closed DevanB closed 7 years ago

DevanB commented 7 years ago

I've been using react-dom-confetti for a while, and love it! However, Sentry has been warning me of a few exceptions that seem to be coming from the library itself. My only formulated thought is it is only happening on IE10+.

Here is the exception as reported by Sentry:

TypeError: Assignment to read-only properties is not allowed in strict mode
  at element (~/dom-confetti/lib/main.js:12)
  at n (~/dom-confetti/lib/main.js:10)
  at elements (~/dom-confetti/lib/main.js:98)
  at nextProps (~/react-dom-confetti/lib/confetti.js:42)
  at prevParentElement (~/react-dom/lib/ReactCompositeComponent.js:601)
...
(44 additional frame(s) were not displayed)

The exception is being reported by dom-confetti/lib/main. Any help debugging and/or fixing this would be greatly appreciated!

daniel-lundin commented 7 years ago

This is the line that fails:

element.classList.add('fetti');

It's seems to be classList that is not well supported in IE, but it should be supported in IE10+. But it's probably better to revert it back to a less-fancy element.classes += ' fetti'

Will fix it!

daniel-lundin commented 7 years ago

I just published a new version of dom-confetti, so if you re-install react-dom-confetti you should get the latest dom-confetti. Let me know if it works out for you!