-
Notifications
You must be signed in to change notification settings - Fork 4k
Gate "Submit to my employer" on the workspace billing restriction #100584
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
Open
MelvinBot
wants to merge
7
commits into
main
Choose a base branch
from
claude-submitToEmployerRestrictedWorkspace
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3e68c46
Gate Submit to my employer on the workspace billing restriction
MelvinBot 1905451
Address review: extract the billing gate and feed it the caller's policy
MelvinBot 121218a
Address review: make the policy the single handle for each billing-ga…
MelvinBot 78c1706
Merge remote-tracking branch 'origin/main' into claude-submitToEmploy…
MelvinBot 52f178e
Merge remote-tracking branch 'origin/main' into claude-submitToEmploy…
MelvinBot aa56099
Fix: run oxfmt on ReportUtils.ts to satisfy the Oxfmt check
MelvinBot f69f527
Merge remote-tracking branch 'origin/claude-submitToEmployerRestricte…
MelvinBot 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
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.
Adding the whole
preferredPolicyobject to this dependency array rebuilds the entire report-details menu on any field change to that policy.This memo produces the full menu-item list. With the object itself as a dep, it now invalidates when a member is added, a category is edited, or
pendingFieldsflips during any workspace write — none of which affect the menu.Once the selector returns a
Pickprojection (see my comment onselectors/Policy.ts:352), depend on the scalar the gate actually reads instead:Same applies to
filteredPoliciesInfo?.firstPolicyat L819.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.
Fixed in 121218a, at the Onyx read rather than in the dependency array.
Swapping the dep to
preferredPolicy?.ownerAccountIDwhile the memo body still closes overpreferredPolicytripsreact-hooks/exhaustive-deps, and it leaves the underlying read pulling the whole policy. So instead both reads are projected:preferredPolicynow usesbillingRestrictionPolicySelector, a module-levelPick<Policy, 'id' | 'ownerAccountID'>projection.filteredPoliciesInfo.firstPolicyis the same projection, per your comment onselectors/Policy.ts:352.Because
useOnyxwraps selectors increateMemoizedSelector, a fixed-size output meansdeepEqualreturns the previous reference when nothing relevant changed. So depending on the object is now equivalent to depending on the scalars: a member add, a category edit, or apendingFieldsflip no longer invalidates the menu.filteredPoliciesInfo?.firstPolicyIDis out of the dep array (the param is gone), and so ispreferredPolicyID— it was only there to be passed through, and ESLint flagged it as unnecessary oncerestrictedPreferredPolicyreplaced it.