You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Profile - "Address line 1" is shown instead of "Address line 2" #77159
Version Number: 9.2.74-1 Reproducible in staging?: Yes Reproducible in production?: No If this was caught during regression testing, add the test name, ID and link from BrowserStack:#76156 Email or phone of affected tester (no customers):jnsdonsoijnods@gmail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Mac 26.1 / Chrome App Component: User Settings
Action Performed:
Go to staging.new.expensify.com
Go to Account > Profile.
Scroll down and click Address.
Expected Result:
"Address line 2" will be shown for the second address line field.
Actual Result:
"Address line 1" is shown instead of "Address line 2".
translate('common.addressLine', 1) → cache key is [locale, 'common.addressLine']
translate('common.addressLine', 2) → cache key is [locale, 'common.addressLine']
Both share the same cache key, so the second call returns the cached result from the first.
What changes do you think we should make in order to solve the problem?
We can update the skipCache in memoizedGetTranslatedPhrase function to
skipCache: (params) => {
const thirdParam = params.at(2);
// Skip cache if there are parameters (even if they're primitives)
return thirdParam !== undefined;
},
What alternative solutions did you explore? (Optional)
Option 1: We should update it to
addressLine: ({lineNumber}: {lineNumber: number}) => `Address line ${lineNumber}`,
Then update all places that use addressLine translations to use object
Option 2: Increase maxArgs to include parameters from 2 -> 3
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Identify the pull request that introduced this issue and revert it.
Please re-state the problem that we are trying to solve in this issue.
Address line 1" is shown instead of "Address line 2
What is the root cause of that problem?
The translation memoization in here incorrectly caches translations with number parameters.
When translate('common.addressLine', 1) and translate('common.addressLine', 2) are called:
Both share the same first two arguments (locale and path), so the memoization uses the same cache key.
The skipCache function checks !isEmptyObject(params.at(2)), which returns false for numbers (since isEmptyObject(1) returns true).
The cache is not skipped, so both calls return the same cached result from the first call ("Address line 1"). The skipCache logic was intended to skip cache only when parameters are non-empty objects (for pluralization), but it doesn't handle primitive parameters like numbers.
Why this was working previously?
Because before we were doing things by passing object parameter translate('common.addressLine', {lineNumber: 1})
What changes do you think we should make in order to solve the problem?
We should skip cache when any parameters are provided not just non-empty objects. This ensures translations with number parameters don't share cache
skipCache: (params) => params.length > 2,
What alternative solutions did you explore? (Optional) Better solution
Remove maxArgs: 2 and skipCache so all arguments are used in the cache key. Now: translate('common.addressLine', 1) → cache key: ['en', 'common.addressLine', 1] translate('common.addressLine', 2) → cache key: ['en', 'common.addressLine', 2]
They are cached separately and return the correct values. This also fixes similar cases like translate('paymentMethodList.bankAccountLastFour', lastFour).
Why skipcache was added
With maxArgs: 2, only locale and path were used for the cache key, ignoring parameters. That meant: translate('common.addressLine', {lineNumber: 1}) → cache key: ['en', 'common.addressLine'] translate('common.addressLine', {lineNumber: 2}) → cache key: ['en', 'common.addressLine'] (same)
To avoid wrong cached results, skipCache was added to bypass the cache when object parameters were present. This was a workaround, not a fix.
Why remove skipCache
It's unnecessary with the correct fix If we remove maxArgs: 2, all arguments including parameters are included in the cache key Different parameters get different cache entries automatically No need to skip the cache
Hmmm... I'd rather revert the culprit and have @mrejdak and @QichenZhu work on this again than try a patch fix. Going to revert instead. Sorry @daledah
Activity
melvin-bot commentedon Dec 9, 2025
Triggered auto assignment to @JmillsExpensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.daledah commentedon Dec 9, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Address line 1" is shown instead of "Address line 2".
What is the root cause of that problem?
We have error here
App/src/languages/en.ts
Line 416 in ba34b92
The translation function
addressLineaccepted a number directly, which conflicted with memoization when parameters weren’t objects.App/src/libs/Localize/index.ts
Lines 105 to 110 in ba34b92
When calling:
Both share the same cache key, so the second call returns the cached result from the first.
What changes do you think we should make in order to solve the problem?
We can update the
skipCacheinmemoizedGetTranslatedPhrasefunction toWhat alternative solutions did you explore? (Optional)
Option 1: We should update it to
Then update all places that use
addressLinetranslations to use objectOption 2: Increase maxArgs to include parameters from 2 -> 3
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
melvin-bot commentedon Dec 9, 2025
Triggered auto assignment to @tylerkaraszewski (
DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.melvin-bot commentedon Dec 9, 2025
💬 A slack conversation has been started in #expensify-open-source
github-actions commentedon Dec 9, 2025
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:
Nodebrute commentedon Dec 9, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Address line 1" is shown instead of "Address line 2
What is the root cause of that problem?
The translation memoization in here incorrectly caches translations with number parameters.
When
translate('common.addressLine', 1)andtranslate('common.addressLine', 2)are called:Both share the same first two arguments (locale and path), so the memoization uses the same cache key.
The skipCache function checks
!isEmptyObject(params.at(2)), which returns false for numbers (since isEmptyObject(1) returns true).The cache is not skipped, so both calls return the same cached result from the first call ("Address line 1"). The skipCache logic was intended to skip cache only when parameters are non-empty objects (for pluralization), but it doesn't handle primitive parameters like numbers.
App/src/libs/Localize/index.ts
Line 109 in 856c94c
Why this was working previously?
Because before we were doing things by passing object parameter
translate('common.addressLine', {lineNumber: 1})What changes do you think we should make in order to solve the problem?
We should skip cache when any parameters are provided not just non-empty objects. This ensures translations with number parameters don't share cache
What alternative solutions did you explore? (Optional) Better solution
Remove
maxArgs: 2andskipCacheso all arguments are used in the cache key. Now:translate('common.addressLine', 1) → cache key: ['en', 'common.addressLine', 1]translate('common.addressLine', 2) → cache key: ['en', 'common.addressLine', 2]They are cached separately and return the correct values. This also fixes similar cases like
translate('paymentMethodList.bankAccountLastFour', lastFour).App/src/libs/Localize/index.ts
Lines 105 to 109 in ce8e25b
Why skipcache was added
With
maxArgs: 2, onlylocaleandpathwere used for the cache key, ignoring parameters. That meant:translate('common.addressLine', {lineNumber: 1}) → cache key: ['en', 'common.addressLine']translate('common.addressLine', {lineNumber: 2}) → cache key: ['en', 'common.addressLine'] (same)To avoid wrong cached results,
skipCachewas added to bypass the cache when object parameters were present. This was a workaround, not a fix.Why remove skipCache
It's unnecessary with the correct fix If we remove
maxArgs: 2, all arguments including parameters are included in the cache key Different parameters get different cache entries automatically No need to skip the cachesituchan commentedon Dec 10, 2025
Offending PR: #76721
cc: @mrejdak @QichenZhu
yuwenmemon commentedon Dec 10, 2025
Hmmm... I'd rather revert the culprit and have @mrejdak and @QichenZhu work on this again than try a patch fix. Going to revert instead. Sorry @daledah
IuliiaHerets commentedon Dec 10, 2025
Issue is not reproducible for QA team on Windows 11 / Chrome in v9.2.74-8
bandicam.2025-12-10.14-49-51-549.mp4
yuwenmemon commentedon Dec 10, 2025
Thanks!
blazejkustra commentedon Dec 10, 2025
@mrejdak is OOO today, he'll look into it tomorrow. Thank you for handling it @yuwenmemon 😄
daledah commentedon Dec 10, 2025
@yuwenmemon @JmillsExpensify I was assigned to this issue and created the PR #77198. But then we decided to revert offending PR.
According to this comment #49931 (comment), I think I should be eligible for payment here.
JmillsExpensify commentedon Dec 11, 2025
Yes, that's correct.
Payment summary: $250 @daledah via Upwork.
JmillsExpensify commentedon Dec 11, 2025
Offer sent, please accept in Upwork
daledah commentedon Dec 12, 2025
Thanks @JmillsExpensify, i accepted
JmillsExpensify commentedon Dec 12, 2025
Paid