Skip to content

Update the contact language when the app switches language (Gleap #226492) - #194

Merged
boehlerlukas merged 1 commit into
masterfrom
gleap/226492-contact-lang-update
Oct 27, 2026
Merged

boehlerlukas merged 1 commit into
masterfrom
gleap/226492-contact-lang-update

Conversation

@boehlerlukas

Copy link
Copy Markdown
Contributor

Fixes Gleap ticket #226492 (https://app.gleap.io/projects/613b5dd730aed737108f87ab/bugs/6adf8ad9f9685966007614f7).

Problem. Hubflo switches language without a full page reload (Turbo). On each visit their integration calls Gleap.identify(userId, data, userHash) again with the same data. checkIfSessionNeedsUpdate saw no changed field and skipped the request, and never compared the active language (<html lang> / setLanguage / browser) with the contact's stored lang. So the contact language stayed on the old value and language-targeted outreach went out in the wrong language.

Fix. checkIfSessionDataNeedsUpdate (used by identify and updateContact) now treats a stored session.lang that differs from getActiveLanguage() as a change. The request already sends lang: getActiveLanguage(), and the server already writes it. Sessions without a stored lang keep the old behaviour (session start fills it).

Verified. npx jest: 34 suites, 586 tests pass. npm run build compiles. Ad-hoc jsdom check: same user + same data + same <html lang> → still skipped; <html lang> switched en → fr → identify is sent.

🤖 Generated with Claude Code

Gleap.identify / updateContact skipped the request when the user data was
unchanged, without comparing the active language. Apps that switch language
without a full reload (Turbo, SPAs updating <html lang>) re-identify with the
same data, so the contact's language in Gleap never updated and
language-targeted outreach used the old language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@boehlerlukas
boehlerlukas merged commit 76201b5 into master Oct 27, 2026
1 check passed
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 this pull request may close these issues.

1 participant