Repository navigation
Remove all optional connectWithoutView from SplitExpenses and refactor initSplitExpense #93040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tgolen
merged 15 commits into
Expensify:main
from
ZhenjaHorbach:remove-all-optional-connectWithoutView-from-SplitExpenses
Jun 23, 2026
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1da39b5
Remove all optional connectWithoutView from SplitExpenses and refacto…
ZhenjaHorbach 34eb9e0
Fix conflicts
ZhenjaHorbach 7b56838
Fix tests
ZhenjaHorbach 8cefb91
Merge branch 'main' into remove-all-optional-connectWithoutView-from-…
ZhenjaHorbach e752c33
Fix mocks for tests
ZhenjaHorbach 0543fd8
Fix conflicts
ZhenjaHorbach 6e2d430
Restore Mobile-Expensify submodule pointer and fix SplitTest lint
ZhenjaHorbach 742a262
Move useRestrictedActionPolicyID tests to hooks folder
ZhenjaHorbach 34868a5
Fix conflicts
ZhenjaHorbach d926fe2
Merge branch 'main' into remove-all-optional-connectWithoutView-from-…
ZhenjaHorbach 37acc82
Refactor code
ZhenjaHorbach cae4f90
Revert changes for fallbackPolicy for getSplitEffectivePolicy
ZhenjaHorbach 9408781
Update getSplitEffectivePolicy for P2P
ZhenjaHorbach d24754d
Fix conflicts
ZhenjaHorbach 4d7b3bd
Fix comments
ZhenjaHorbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
| import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type {Policy} from '@src/types/onyx'; | ||
| import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails'; | ||
| import useOnyx from './useOnyx'; | ||
|
|
||
| /** | ||
| * Resolves the policy ID to redirect to `RESTRICTED_ACTION` when the given policy's billable actions | ||
| * are restricted (e.g. expired/owing workspace), or `undefined` when the action is allowed. | ||
| * | ||
| * Centralizes the billing-grace / amount-owed Onyx reads + the `shouldRestrictUserBillableActions` | ||
| * check so callers (e.g. the split entry points) don't each duplicate them. | ||
| */ | ||
| function useRestrictedActionPolicyID(policy: OnyxEntry<Policy>): string | undefined { | ||
| const {accountID} = useCurrentUserPersonalDetails(); | ||
| const [ownerBillingGracePeriodEnd] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END); | ||
| const [userBillingGracePeriodEnds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_USER_BILLING_GRACE_PERIOD_END); | ||
|
ZhenjaHorbach marked this conversation as resolved.
Resolved
|
||
| const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED); | ||
|
|
||
| if (!policy || !shouldRestrictUserBillableActions(policy, ownerBillingGracePeriodEnd, userBillingGracePeriodEnds, amountOwed, accountID)) { | ||
| return undefined; | ||
| } | ||
| return policy.id; | ||
| } | ||
|
|
||
| export default useRestrictedActionPolicyID; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like
allPoliciesis only used withfindSplitPolicyForCUstomUnit()which only referencespolicy.customUnits. If that's correct, then please use a selector here to only subscribe topolicy.customUnits.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this makes sense
You are right that
findSplitPolicyForCustomUnitonly readspolicy.customUnits, but it uses them to find and return a specific full policy, which thedeleteTransactionscallback then passes downstreamThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see that too. Thanks!