Skip to content

Identity is empty after executing identify #301

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
majdanov opened this issue Mar 28, 2025 · 3 comments · May be fixed by #302
Open

Identity is empty after executing identify #301

majdanov opened this issue Mar 28, 2025 · 3 comments · May be fixed by #302
Assignees

Comments

@majdanov
Copy link

majdanov commented Mar 28, 2025

Description

flagsmith.identity is empty after executing flagsmith.identify

await flagsmith.identify(accountId);
console.log(flagsmith.identity); // undefined
if (!flagsmith.identity) { // always true because identity is undefined
  await flagsmith.identify(accountId);
}

Context

I am trying to upgrade flagsmith from 3.24.0 to 9. The problem is reproduced from version 5.0.0 and later.

Is it a bug or am I doing something wrong?

@kyle-ssg
Copy link
Member

Hi @majdanov, you should be able to access this via

flagsmith.getContext()?.identity?.identifier

In future, the recommended way to identify will be to use the setContext method. However until then, I think we'll fix this and re-add the flagsmith.identity initialisation for backwards compatibility.

@kyle-ssg kyle-ssg linked a pull request Mar 28, 2025 that will close this issue
@kyle-ssg kyle-ssg self-assigned this Mar 28, 2025
@chris-richmond
Copy link

@kyle-ssg the documentation recommends the flagsmith.identify(...) approach. Should I open a different issue for this, or would you mind updating the documentation with the current PR?

https://docs.flagsmith.com/clients/javascript#example-identifying-a-user-after-initialising-the-client

Thanks

@kyle-ssg
Copy link
Member

@chris-richmond That's fine, we're going to be discussing internally about how to migrate the documentation towards context. In the meantime we'll be aiming to be fully backwards compatible.

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 a pull request may close this issue.

3 participants