Skip to content

distinct_id becomes null after upgrading from v3.0.5 to v3.0.9 #287

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

Open
enu-kuro opened this issue Apr 18, 2025 · 1 comment
Open

distinct_id becomes null after upgrading from v3.0.5 to v3.0.9 #287

enu-kuro opened this issue Apr 18, 2025 · 1 comment

Comments

@enu-kuro
Copy link

enu-kuro commented Apr 18, 2025

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:
#273

@enu-kuro
Copy link
Author

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.

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

No branches or pull requests

1 participant