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 181 forks source link

[bugfix] reset anonymousId properly #897

Closed jboteros closed 4 weeks ago

jboteros commented 7 months ago

.reset(true) function had a bad behavior because when is resetting the anonymousId comes form this.state.userInfo instead of this.userInfo, consulting a previous version of the field.

oscb commented 6 months ago

@jboteros can we get more details on how to repro the issue you are bumping into here?

this.userInfo just maps into this.store.userInfo so in theory it should be the same thing either way. I'm curious if this has fixed your issues and how to repro to understand better what's going on.

jboteros commented 6 months ago

@jboteros can we get more details on how to repro the issue you are bumping into here?

this.userInfo just maps into this.store.userInfo so in theory it should be the same thing either way. I'm curious if this has fixed your issues and how to repro to understand better what's going on.

Yes, that implementation fix our bug and now we have a proper reset user flow.

Basically the issue was related of the instance of the userInfo because you reset the userInfo in this.state.userInfo but fetch it in this.userInfo (at this point that instance is not update)

For now I created a patch over you package waiting for your fix and update it

BTW if is not clear the bug is related on the reset() and the anonymousID is not reseted properly conserve the same previous one.

Thanks!

alanjcharles commented 1 month ago

Hi @jboteros apologies but is this still an issue? Oscar is no longer with Segment and I'm just trying to catch up on things here. Thanks!

hvardhan-unth commented 4 weeks ago

Raised a PR with updated code PR : https://github.com/segmentio/analytics-react-native/pull/950