distinct_id becomes null after upgrading from v3.0.5 to v3.0.9
After upgrading mixpanel-react-native from v3.0.5 to v3.0.9, all events started showing distinct_id: null ("<nil>" in Mixpanel).
This seems to match the issue described in this pull request: https://github.com/mixpanel/mixpanel-react-native/pull/273
I have a question regarding the implementation of initializationCompletePromise() in MixpanelPersistent.
Currently, the method is defined as:
async initializationCompletePromise(token) {
Promise.all([
this.loadIdentity(token),
this.loadSuperProperties(token),
this.loadTimeEvents(token),
this.loadOptOut(token),
this.loadAppHasOpenedBefore(token),
]);
}
It seems that the Promise.all() result is not returned, meaning that the initialize() method might proceed before identity and other states are fully loaded.
Shouldn't it be written as:
async initializationCompletePromise(token) {
return Promise.all([
this.loadIdentity(token),
this.loadSuperProperties(token),
this.loadTimeEvents(token),
this.loadOptOut(token),
this.loadAppHasOpenedBefore(token),
]);
}
This would ensure that the asynchronous loading completes before other methods rely on the identity state.