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
[Due for payment 2026-01-27] [Odometer] Distance expense category removed on 2nd policy switch #79598
Coming from this, a bug exists for Distance Expenses. The category field is hidden on the confirm details page every other time that the workspace is changed.
Creating a seperate issue as it occurs for all distance expense issues and shouldn't block this PR.
However, this useEffect does not work every time participants changes, so it works only once when one of the parameters changes, which is not a very reliable approach.
What changes do you think we should make in order to solve the problem?
We can do the following:
Pass the option value here in onFinish to make it easier to get policyID:
For example, we can simply add participants or ids participants. 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.
but the existingTransaction is undefined, because at this point we are working only with a draft.
What changes do you think we should make in order to solve the problem?
We can move the useEffect below definition of defaultCategory and modify the useEffect in such a way:
useEffect(() => {
for (const item of transactions) {
if (!item.category) {
// If the expense had his category cleared due to unsaved changes (i.e. changing to recipient to one that does not have category)
// then we should reset the category to it's last saved value
const existingCategory = existingTransaction?.category ?? defaultCategory;
if (existingCategory) {
const isExistingCategoryEnabled = policyCategories?.[existingCategory]?.enabled;
if (isExistingCategoryEnabled) {
setMoneyRequestCategory(item.transactionID, existingCategory, policy);
}
}
continue;
}
}
// We don't want to clear out category every time the transactions change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [policy?.id, policyCategories, transactionsCategories]);
(adding ?? defaultCategory).
What alternative solutions did you explore? (Optional)
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.
FYI @Eskalifer1 this was not opened for external contributors. I created it for @DylanDylann to implement based on a bug he found in the linked PR. I'll leave it up to him whether he want's to implement or switch to C+ reviewer though.
Hi @Julesssss Oh, I see, it seems that this bug is already in production and does not actually relate to Odometr's functionality. But i'm totally okay with that!
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.4-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
Issue is ready for payment but no BZ is assigned. @heyjennahay you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
Activity
Eskalifer1 commentedon Jan 14, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance expense category removed on 2nd policy switch
What is the root cause of that problem?
For distance requests, the default value is set here:
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 407 to 416 in a49fd46
However, this useEffect does not work every time participants changes, so it works only once when one of the parameters changes, which is not a very reliable approach.
What changes do you think we should make in order to solve the problem?
We can do the following:
Pass the option value here in
onFinishto make it easier to getpolicyID:App/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
Lines 165 to 167 in a49fd46
(This step can be skipped if we can get the policyID in another way)
We get this value here:
App/src/pages/iou/request/step/IOURequestStepParticipants.tsx
Line 316 in a49fd46
And here we set the category value when participants change:
App/src/pages/iou/request/step/IOURequestStepParticipants.tsx
Lines 333 to 334 in a49fd46
We need to add logic for obtaining the default category, and if it is a distance request, then set it:
PS: Implementation details can be discussed during the PR.
What alternative solutions did you explore? (Optional)
We can add some information related to participants, related to participants:
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Lines 407 to 416 in a49fd46
For example, we can simply add participants or ids participants.
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.
imadirtydog commentedon Jan 14, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Distance expense category removed on 2nd policy switch
What is the root cause of that problem?
In the useEffect here
App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Line 385 in a49fd46
We are doing:
but the existingTransaction is undefined, because at this point we are working only with a draft.
What changes do you think we should make in order to solve the problem?
We can move the useEffect below definition of defaultCategory and modify the useEffect in such a way:
(adding ?? defaultCategory).
What alternative solutions did you explore? (Optional)
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.
Julesssss commentedon Jan 14, 2026
FYI @Eskalifer1 this was not opened for external contributors. I created it for @DylanDylann to implement based on a bug he found in the linked PR. I'll leave it up to him whether he want's to implement or switch to C+ reviewer though.
Eskalifer1 commentedon Jan 14, 2026
Hi @Julesssss Oh, I see, it seems that this bug is already in production and does not actually relate to Odometr's functionality. But i'm totally okay with that!
melvin-bot commentedon Jan 17, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
melvin-bot commentedon Jan 19, 2026
If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.
If a regression has occurred and you are the assigned CM follow the instructions here.
If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.
5 remaining items
melvin-bot commentedon Jan 20, 2026
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jan 20, 2026
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.4-6 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2026-01-27. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jan 27, 2026
Issue is ready for payment but no BZ is assigned. @heyjennahay you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!
heyjennahay commentedon Jan 28, 2026
Hi @DylanDylann just checking, is a BugZero checklist needed for this issue?
DylanDylann commentedon Jan 29, 2026
Regression Test Proposal
heyjennahay commentedon Feb 3, 2026
Thanks @DylanDylann
Test created here: https://github.com/Expensify/Expensify/issues/596292
Julesssss commentedon Feb 3, 2026
Payment to be grouped under the Odometer project