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 2025-12-26] [$250] Distance Expense - Rate is not valid blinks #76771
Then the previous logic sets formError again, causing the blinking behavior.
What changes do you think we should make in order to solve the problem?
We should use debouncedFormError to display the error message and the red dot. Since debouncedFormError does not update immediately, it will consolidate multiple rapid updates into a single change and prevent the blinking.
Once the API responds, the transaction data is updated. Because of that update, the condition for setting the error message is triggered again when the transaction data finishes updating. Because the useEffect hook has transaction as a dependency. This is what causes the blinking.
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run if it's just setFormError that changes
This is transaction changed after we call GetRouteForDraft
Screen.Recording.2025-12-05.at.13.20.21.mov
What changes do you think we should make in order to solve the problem?
To resolve this issue, we shouldn't update setFormError while GetRouteForDraft is loading. We should delay setting setFormError until GetRouteForDraft has finished.
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.
// reset the form error whenever the screen gains or loses focus
setFormError('');
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run if it's just setFormError that changes
// If none of the above conditions are met, display the rate error
setFormError(errorKey);
But the first effect also clears the error when the transaction data changes.
What changes do you think we should make in order to solve the problem?
This commit adds the transaction to the deps because we use it inside the effect, but then we take it out and put it in a shouldDisplayFieldError variable but we don't remove the transaction object from the effect deps.
// reset the form error whenever the screen gains or loses focus
setFormError('');
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps -- we don't want this effect to run if it's just setFormError that changes
@bernhardoj@VictoriaExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
Activity
melvin-bot commentedon Dec 4, 2025
Triggered auto assignment to @VictoriaExpensify (
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.[-]Distance Expense - Rate is not valid blinks[/-][+][$250] Distance Expense - Rate is not valid blinks[/+]melvin-bot commentedon Dec 5, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021996773865971394579
melvin-bot commentedon Dec 5, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane (
External)VictoriaExpensify commentedon Dec 5, 2025
Yeah we should fix this, but it's a low priority I would say
cretadn22 commentedon Dec 5, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-12-05 04:35:23 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
The message
"Rate not valid for this workspace. Please select an available rate from the workspace."briefly appears and then disappearsWhat is the root cause of that problem?
The App sets
formErrorhere:App/src/components/MoneyRequestConfirmationList.tsx
Line 455 in 04315c9
After that, another part of the logic clears the error:
App/src/components/MoneyRequestConfirmationList.tsx
Line 427 in 04315c9
Then the previous logic sets
formErroragain, causing the blinking behavior.What changes do you think we should make in order to solve the problem?
We should use debouncedFormError to display the error message and the red dot. Since debouncedFormError does not update immediately, it will consolidate multiple rapid updates into a single change and prevent the blinking.
App/src/components/MoneyRequestConfirmationList.tsx
Lines 987 to 993 in 04315c9
And passing formError={debouncedFormError} to MoneyRequestConfirmationListFooter
App/src/components/MoneyRequestConfirmationList.tsx
Line 1105 in 04315c9
What alternative solutions did you explore? (Optional)
Only clear the error when it matches specific cases:
Or Using
clearFormErrors(['iou.error.genericSmartscanFailureMessage', 'iou.receiptScanningFailed']);Reference to place:
App/src/components/MoneyRequestConfirmationList.tsx
Line 427 in 04315c9
huult commentedon Dec 5, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
"Rate not valid for this workspace. Please select an available rate from the workspace." blinks
What is the root cause of that problem?
This issue occurs only on the
distance mapflow, not onmanual distance, because themanual distanceflow does not triggerGetRouteForDraft.When I select a
participantand navigate to theMoney Request Confirmationscreen, it triggersGetRouteForDraftto load the map distance.App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Line 288 in 46ec466
App/src/libs/actions/Transaction.ts
Line 244 in 69a159c
Screen.Recording.2025-12-05.at.13.14.10.mov
Once the API responds, the
transactiondata is updated. Because of that update, the condition for setting the error message is triggered again when thetransactiondata finishes updating. Because theuseEffecthook hastransactionas a dependency. This is what causes the blinking.App/src/components/MoneyRequestConfirmationList.tsx
Lines 428 to 431 in 6fbad93
App/src/components/MoneyRequestConfirmationList.tsx
Lines 456 to 468 in 6fbad93
This is transaction changed after we call
GetRouteForDraftScreen.Recording.2025-12-05.at.13.20.21.mov
What changes do you think we should make in order to solve the problem?
To resolve this issue, we shouldn't update
setFormErrorwhileGetRouteForDraftisloading. We should delay settingsetFormErroruntilGetRouteForDrafthas finished.App/src/components/MoneyRequestConfirmationList.tsx
Line 435 in 6fbad93
update to
if (!transactionID || !isDistanceRequest || !isMovingTransactionFromTrackExpense || !isPolicyExpenseChat || transaction?.comment?.isLoading === true) {Screen.Recording.2025-12-05.at.13.19.11.mov
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.
bernhardoj commentedon Dec 5, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Rate is not valid error blinks.
What is the root cause of that problem?
When the component mounts, we have this logic to clears the form error on mount.
App/src/components/MoneyRequestConfirmationList.tsx
Lines 418 to 431 in 57c0cbc
And another effect that sets the invalid rate error.
App/src/components/MoneyRequestConfirmationList.tsx
Lines 455 to 456 in 57c0cbc
But the first effect also clears the error when the transaction data changes.
What changes do you think we should make in order to solve the problem?
This commit adds the
transactionto the deps because we use it inside the effect, but then we take it out and put it in ashouldDisplayFieldErrorvariable but we don't remove thetransactionobject from the effect deps.So, we can remove
transactionfrom the deps.App/src/components/MoneyRequestConfirmationList.tsx
Lines 418 to 431 in 57c0cbc
21 remaining items
melvin-bot commentedon Dec 19, 2025
@bernhardoj @VictoriaExpensify The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Dec 26, 2025
Payment Summary
Upwork Job
BugZero Checklist (@VictoriaExpensify)
melvin-bot commentedon Jan 1, 2026
@VictoriaExpensify Huh... This is 4 days overdue. Who can take care of this?
melvin-bot commentedon Jan 2, 2026
@VictoriaExpensify Still overdue 6 days?! Let's take care of this!
VictoriaExpensify commentedon Jan 5, 2026
Payment Summary:
C+: @sobitneupane owed $250 via NewDot
C+: @bernhardoj owed $250 via NewDot
Thanks!
bernhardoj commentedon Jan 5, 2026
Requested in ND.
garrettmknight commentedon Jan 31, 2026
$250 approved for @bernhardoj
garrettmknight commentedon Mar 16, 2026
$250 approved for @sobitneupane