[No QA] Perf: select narrow admin policy data instead of the whole policy array - #99174
Open
TMisiukiewicz wants to merge 4 commits into
Open
[No QA] Perf: select narrow admin policy data instead of the whole policy array#99174TMisiukiewicz wants to merge 4 commits into
TMisiukiewicz wants to merge 4 commits into
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
TMisiukiewicz
marked this pull request as ready for review
August 21, 2026 11:29
melvin-bot
Bot
requested review from
Krishna2323 and
flaviadefaria
and removed request for
a team
August 21, 2026 11:29
|
@Krishna2323 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] |
Contributor
|
I can review if C+ review is required. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explanation of Change
Three consumers of
activeAdminPoliciesSelectorsubscribed to the wholepolicy_collection through a selector returningPolicy[], souseOnyxdeep-compared every administered policy —employeeList,connections,customUnitsand all — on each policy-collection update, even though none of them needed the full objects.TimeSensitiveSectionnow usescreateTimeSensitiveAdminPoliciesSelector, which returns a narrowPick<Policy, 'id' | 'name' | 'achAccount' | 'policyAccountID'>projection plus thebrokenConnectionslist. The broken-connection loop moved from the render body into the selector because the sync-in-progress check needs each policy'sconnections, which the projection deliberately drops.EnabledPage(2FA) now usescreateHasAdminPolicyWithXeroConnectionSelector, which returns a boolean instead of the array.DynamicIOURequestStepAccountantnow uses the existinguseHasActiveAdminPolicieshook, which already selects a boolean.sortPoliciesByNamealso copies before sorting: callers pass memoized selector output, and sorting it in place makes the nextuseOnyxdeep-compare report a spurious change. Filtering logic is unchanged — every path still goes throughgetActiveAdminWorkspaces, andgetPolicyRoletreats the previouslogin ?? ''and the now-passedundefinedidentically. Unit tests added for both new selectors and for the non-mutating sort.Perf gain: ~30ms save on every policy collection update
Fixed Issues
$ #99176
PROPOSAL:
Tests
Offline tests
Same as tests.
getActiveAdminWorkspacesstill receives the offline state viagetIsOffline(), so pending-delete workspaces are treated exactly as before.QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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