Repository navigation
fix: remove per diem page loading gate that never resolves - #100956
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@BartekObudzinski Tag me when it’s ready. |
|
@huult ready |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce12d3cdb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /> | ||
| )} | ||
| {!hasVisibleSubRates && subtitleContent} | ||
| <WorkspacePerDiemTable |
There was a problem hiding this comment.
Provision a custom unit before exposing the import CTA
For the exact workspace state this change now exposes (arePerDiemRatesEnabled with no PerDiem custom unit), writers can tap the newly rendered empty-state Import spreadsheet button, complete the CSV mapping, and then have the import silently return: ImportedPerDiemPage.importRates requires perDiemCustomUnit.customUnitID and exits when it is absent (lines 119–123). Consequently, affected workspaces no longer spin, but still cannot add their first per-diem rate; create/provision the unit before enabling this CTA or handle the absent-unit import path.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Screen.Recording.2026-09-11.at.23.18.20.mov
@BartekObudzinski You're right that removing isLoading fixes the infinite spinner. However, the import still doesn't work when customUnit is undefined.
I tested this case and confirmed that the import exits because perDiemCustomUnit.customUnitID is missing. Could you take another look at this? Do we need to adjust the import function to handle the missing custom unit, or should we provision the custom unit before exposing the import CTA?
There was a problem hiding this comment.
Confirmed, importRates exits at the !perDiemCustomUnit?.customUnitID check so nothing happens after mapping.
It's pre existing. Before this PR the spinner made the button unreachable, so the page goes from fully broken to working except that one action.
Provisioning on page render like Codex suggests would write policy state just from opening a read only page. The right place is the import itself, and it needs a backend answer on whether ImportPerDiemRates creates the unit from a customUnitID that doesn't exist yet.
Keeping this PR to the spinner. The import, and the reason these workspaces have arePerDiemRatesEnabled: true with no unit, go into a separate issue.
There was a problem hiding this comment.
Screen.Recording.2026-09-11.at.20.16.05.mov
There was a problem hiding this comment.
@mountiny I need some advice on this. I can confirm the spinner issue is fixed, but I can't approve the PR yet because we found an import issue that requires the backend team to investigate and confirm the correct solution.
Could you help confirm whether we should proceed with this PR while tracking the import issue separately, or hold this PR until the backend team can provide a complete solution?
One thing I'm wondering is whether these two issues could actually have the same RCA, since both seem to be related to customUnitID being undefined. If that's the case, once the underlying issue is fixed, we wouldn't need to remove the spinner fix, right @BartekObudzinski? Just a hypothesis from my side, so I'd like to get your thoughts.
There was a problem hiding this comment.
Yes, both problems come from the same state: a policy that has arePerDiemRatesEnabled set to true and no PerDiemInternational custom unit.
One correction to my earlier comment. The user can still open the import while the spinner shows. secondaryActions adds Import spreadsheet to the More dropdown in the header, and the header renders outside the isLoading branch.
A fix at the data source removes the condition that starts the loading state, but it does not make the loading state correct. customUnit === undefined has no terminal condition, because an absent value cannot tell you if the data is late or if it will never arrive. Any workspace that a backfill misses will show the spinner forever.
The gate is also redundant. AccessOrNotFoundWrapper already shows a full screen loader until the policy is in Onyx, and customUnits is a field on the policy, not something that OpenPolicyPerDiemRatesPage fetches.
We confirmed that it works, so I prefer to merge it and track the import separately
There was a problem hiding this comment.
@MelvinBot create a follow up issue for this case and assign @mountiny @BartekObudzinski @huult. Technically, we should fix it here but for urgency we wont wait with merging this pr.
There was a problem hiding this comment.
Created the follow-up: #101066 — assigned mountiny, BartekObudzinski, and huult.
It tracks the silent import failure at ImportedPerDiemPage.tsx:122 plus the two open questions: why a policy ends up with arePerDiemRatesEnabled: true and no PerDiemInternational custom unit, and whether ImportPerDiemRates can create the unit or the App has to provision it first.
No existing issue covered this, so nothing to dedupe against.
view run · no recording available
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen.Recording.2026-09-12.at.15.45.40.movAndroid: mWeb ChromeScreen.Recording.2026-09-12.at.15.47.05.moviOS: HybridAppScreen.Recording.2026-09-12.at.15.49.09.moviOS: mWeb SafariScreen.Recording.2026-09-12.at.15.49.46.movMacOS: Chrome / SafariScreen.Recording.2026-09-12.at.15.43.10.mov |
There was a problem hiding this comment.
Screen.Recording.2026-09-12.at.15.43.10.mov
LGTM. (#100956 (comment))
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
Not an emergency, we got the ai reviewers covered with codex |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.78-0 🚀
|
|
🤖 No help site changes are required for this PR, so I did not create a docs PR. This change removes a loading gate ( What I checkedThe diff — The user-visible result — the empty state that admins now reach already existed and is unchanged. Its Import spreadsheet button is defined at The articles — both existing Per diem articles remain accurate as written:
Neither article documents loading behavior, and the help site does not describe spinners or empty states, so there is nothing to update. @BartekObudzinski, please confirm you agree that no help site update is needed here. If you want the Per diem articles refreshed for something else (for example, to document the empty state and its Import spreadsheet action for workspaces with no rates yet), reply with view run · no recording available |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.78-3 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
The workspace Per Diem page inferred its loading state from data absence:
const isLoading = !isOffline && customUnit === undefined;.getPerDiemCustomUnitreturnsundefinedwhenever a policy has no custom unit namedPerDiemInternational, and a policy can legitimately havearePerDiemRatesEnabled: truewith no such unit, so on those workspaces the spinner never stopped.That gate could not be correct, because data absence cannot distinguish "not yet" from "never". It was also redundant:
AccessOrNotFoundWrapperalready holds a full-screen loader until the policy is in Onyx, andcustomUnitsis a field on the policy object rather than somethingOpenPolicyPerDiemRatesPagefetches. By the time the page body renders, the answer is already final, so there is no wait to indicate.This removes the gate and lets the table render, which shows the existing empty state (with its import-spreadsheet CTA) when a policy has no per diem rates. For any policy that does have a custom unit the behaviour is unchanged, since
isLoadingwas alreadyfalsein that case and the rows were driven byhasVisibleSubRates.Fixed Issues
$ #100968
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-09-11.at.13.56.47.mov