Skip to content
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

fix: assign default options before enableNative check #1007

Merged
merged 3 commits into from
Jul 31, 2020

Conversation

cruzach
Copy link
Contributor

@cruzach cruzach commented Jul 29, 2020

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

the changes i made in #993 result in deviceContext not initializing by default, since the default enableNative:true isn't set until right after

💡 Motivation and Context

#993 (comment)

💚 How did you test it?

existing tests

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • All tests passing
  • No breaking changes

🔮 Next steps

@bruno-garcia
Copy link
Member

Note sure how CI breaks:
https://travis-ci.com/github/getsentry/sentry-react-native/jobs/366223716#L274

This change is unrelated

@jennmueng
Copy link
Member

jennmueng commented Jul 30, 2020

Note sure how CI breaks:
https://travis-ci.com/github/getsentry/sentry-react-native/jobs/366223716#L274

This change is unrelated

This actually breaks because the function returns a ReactNativeOptions where defaultIntegrations can be undefined

src/js/sdk.ts Outdated
@@ -71,10 +71,10 @@ export function init(
},
})
);
options = assignDefaultOptions(options);
Copy link
Member

@jennmueng jennmueng Jul 30, 2020

Choose a reason for hiding this comment

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

Suggested change
options = assignDefaultOptions(options);
options = {
...DEFAULT_OPTIONS,
...options
}

Instead of using a function call, I would do this and define the DEFAULT_OPTIONS as a constant object, this way typescript knows for sure that defaultIntegrations is defined.

Copy link
Member

Choose a reason for hiding this comment

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

This file needs a massive refactor/clean now that I look at it, but I'll take care it later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea 👍
addressed in the most recent commit

Copy link
Member

Choose a reason for hiding this comment

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

Oh the build is failing still, this would be fixed if you move the default options setting code before the if statement that sets the default integrations above it. Otherwise everything else looks good.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gotchya, fixed that & the build is passing now

@cruzach cruzach requested a review from jennmueng July 30, 2020 13:47
Copy link
Member

@jennmueng jennmueng left a comment

Choose a reason for hiding this comment

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

Looks good!

@bruno-garcia bruno-garcia merged commit 1a1ebcc into getsentry:master Jul 31, 2020
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.

3 participants