Repository navigation
Update the contact language when the app switches language (Gleap #226492) - #194
Merged
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.checkIfSessionNeedsUpdatesaw no changed field and skipped the request, and never compared the active language (<html lang>/setLanguage/ browser) with the contact's storedlang. 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 storedsession.langthat differs fromgetActiveLanguage()as a change. The request already sendslang: getActiveLanguage(), and the server already writes it. Sessions without a storedlangkeep the old behaviour (session start fills it).Verified.
npx jest: 34 suites, 586 tests pass.npm run buildcompiles. Ad-hoc jsdom check: same user + same data + same<html lang>→ still skipped;<html lang>switcheden→fr→ identify is sent.🤖 Generated with Claude Code