segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
354 stars 182 forks source link

Fix can not read property of undefined when identity trait value is undefined. #844

Closed shubhamdeol closed 1 year ago

shubhamdeol commented 1 year ago

This PR fixes the issue https://ekeekaran-ventures.sentry.io/share/issue/c97dcae32cde4f3f832e90cd363fdd23/

in older plugin we were able to send undefined values as trait but now if I will call

identify(userId, {
   enabled: undefined
})

error was getting thrown in this case. Fixed this passing empty string if value is undefined.

oscb commented 1 year ago

@shubhamdeol updated your PR to fix the prettier fixes. All looks good to me, thanks for the contribution! I'll merge after the CI passes.