From 3b1775b86a618d6bd362a6b08c46e4e2aba28d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jochen=20H=C3=B6rmann?= Date: Fri, 18 Oct 2024 13:24:00 +0200 Subject: [PATCH] fix: keep identity identifier when setting user traits in handleResponse (#262) --- flagsmith-core.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flagsmith-core.ts b/flagsmith-core.ts index 88d6cc2..b76a167 100644 --- a/flagsmith-core.ts +++ b/flagsmith-core.ts @@ -120,7 +120,10 @@ const Flagsmith = class { const flagsChanged = getChanges(this.oldFlags, flags); const traitsChanged = getChanges(this.evaluationContext.identity?.traits, userTraits); if (identifier || Object.keys(userTraits).length) { - this.evaluationContext.identity = {traits: userTraits}; + this.evaluationContext.identity = { + ...this.evaluationContext.identity, + traits: userTraits, + }; if (identifier) { this.evaluationContext.identity.identifier = identifier; }