Skip to content

ref(offline integration): Move event listener setup from constructor to setupOnce #2889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

piotr-cz
Copy link
Contributor

Event listener should be set up after hub is set on instance (in setupOnce method) as event may be fired before hub is set (hub is used in _sendEvents).

IMHO it's bad practice to have business logic in constructor.


Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@piotr-cz piotr-cz changed the title Integrations: Offline Move event listeners setup from constructor to setupOnce Integrations/Offline: Move event listeners setup from constructor to setupOnce Sep 10, 2020
Copy link
Member

@lobsterkatie lobsterkatie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct - this should be done in setupOnce. Thanks for the fix!

@lobsterkatie lobsterkatie changed the title Integrations/Offline: Move event listeners setup from constructor to setupOnce ref(offline integration): Move event listener setup from constructor to setupOnce Sep 11, 2020
@lobsterkatie lobsterkatie merged commit b7bbf35 into getsentry:master Sep 11, 2020
@piotr-cz piotr-cz deleted the bugfix/offline-add-events-in-setupOnce branch September 11, 2020 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants