rollbar / rollbar-react

React features to enhance using Rollbar.js in React Applications
https://docs.rollbar.com/docs/react
MIT License
42 stars 10 forks source link

Allow rollbar instance from alternate import/require #37

Closed waltjones closed 2 years ago

waltjones commented 2 years ago

Description of the change

The Provider validates the Rollbar instance, when one is in the props, by testing instanceof the default Rollbar import. This fails when the instance was constructed from another import or require. The specific issue report involves using the noconflict bundle.

This PR looks for an initialized options object instead. This will successfully catch common errors like passing the constructor function or failing to initialize before passing the instance.

Type of change

Related issues

Fixes https://github.com/rollbar/rollbar-react/issues/24

Development

Code review