Repository navigation
[No QA] Show upgrade modal if user has no eliglbe policy for moving expenses - #97280
Conversation
|
@ChavdaSachin Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Does this need a c+ review? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 297bc91881
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@ChavdaSachin Yes, please review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@ChavdaSachin this has been assigned to you for a while, can you complete your review? |
|
@trjExpensify I am unable to repro this. |
|
@daledah I think you tested something similar previously, can you repro the issue / review this PR? |
|
Sure, i'm checking now |
|
@s77rt as an employee, i can't leave the workspace
Screen.Recording.2026-08-05.at.23.27.41.mov |
|
Hmm can the admin remove the employee? |
|
@daledah weird, why are you getting a DC error when your email address is on a domain that isn't domain controlled? 🤔 |
@s77rt i got this error
|
|
Hmm not sure, maybe we should just move forward and not block on this. I was able to reproduce the issue and confirmed the solution works. Can you please review the code and complete the reviewer checklist |
Reviewer Checklist
Screenshots/VideosMacOS: Chrome / Safariweb.mov |
| return {policyForMovingExpensesID: undefined, policyForMovingExpenses: undefined, shouldSelectPolicy: true, shouldNavigateToUpgradePath: false}; | ||
| } | ||
|
|
||
| return {policyForMovingExpensesID: undefined, policyForMovingExpenses: undefined, shouldSelectPolicy: false, shouldNavigateToUpgradePath: true}; |
There was a problem hiding this comment.
With the new early return added, the return at the end of the hook becomes unreachable.
Trace it: to get past the new gate, resolvedPolicyID must be truthy. If validExpensePolicyID were set we'd have already returned in the branch above, so resolvedPolicyID truthy means singlePolicyID is truthy. And with singlePolicyID truthy, one of the last two branches always returns:
isMemberOfMoreThanOnePolicy === false-> caught byif (singlePolicyID && !isMemberOfMoreThanOnePolicy)isMemberOfMoreThanOnePolicy === true-> caught byif (isMemberOfMoreThanOnePolicy)
So the fallback at the bottom can never run
There was a problem hiding this comment.
But this is not a blocker? That's a fallback still, let's move forward if we have nothing to fix
daledah
left a comment
There was a problem hiding this comment.
Just one minor comment; otherwise LGTM
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #97276 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
neil-marcellini
left a comment
There was a problem hiding this comment.
NAB: pls add an automated test to ensure this doesn't regress. Can be done in a follow up PR.
|
🚧 neil-marcellini 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! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.4.52-0 🚀
|
Help site review — no docs changes requiredI reviewed this PR against the help site articles under Why: The change is a narrow edge-case guard in Articles I checked
If you'd rather have this behavior called out in the help site anyway (e.g., a note that creating a report requires an eligible group workspace), reply and I'll draft a HelpDot PR for you to review and mark |
|
🚀 Deployed to production by https://github.com/roryabraham in version: 9.4.52-11 🚀
Bundle Size Analysis (Sentry): |
| @@ -111,6 +111,11 @@ function usePolicyForMovingExpenses(isPerDiemRequest?: boolean, isTimeRequest?: | |||
| const resolvedPolicyID = validExpensePolicyID ?? singlePolicyID; | |||
| const [resolvedPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${resolvedPolicyID}`); | |||
|
|
|||
| // User has no eligible policy | |||
| if (!resolvedPolicyID) { | |||
There was a problem hiding this comment.
This early return treats "no resolved policy" as "user has no eligible workspace" and sends them to the upgrade screen, without checking whether policies have finished loading. During Onyx cold start the collection reads empty, so a member of a group workspace can land on the Collect upgrade screen. Fixed in #101465.

Explanation of Change
Show upgrade modal if user has not eligible policy for moving expenses
Fixed Issues
$ #97276
PROPOSAL:
Tests
companydomain.com(steps below for the employee account)
Create reportyou get the upgrade modalScreen.Recording.2026-07-28.at.9.43.08.PM.mov
Offline tests
n/a
QA Steps
n/a
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