-
Notifications
You must be signed in to change notification settings - Fork 4k
perf: Add NON_PERSONAL_AND_WORKSPACE_CARD_LIST derived value #79347
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
mountiny
merged 25 commits into
Expensify:main
from
callstack-internal:perf/open-report-derived-cards
Jan 27, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e4bafc2
add PERSONAL_AND_WORKSPACE_CARD_LIST derived value
LukasMod 8d50afd
move defaultExpensifyCard to useSearchTypeMenuSections
LukasMod e62e95a
restore useFilterFormValues
LukasMod f6cc44d
add isCard guard to filterCardsHiddenFromSearch
LukasMod 1aadaf5
prettier
LukasMod a292163
move updateAdvancedFilters useEffect to useFilterFormValues
LukasMod bcde84e
rename to NON_PERSONAL_AND_WORKSPACE_CARD_LIST
LukasMod 9f17e50
consolidate defaultExpensifyCard useMemo
LukasMod c72f71a
prettier
LukasMod 73ff1e7
revert moving useEffect to useFilterFormValues
LukasMod e9d6b62
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod d3108e3
add defaultExpensifyCardSelector
LukasMod e315d20
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod 9a626b4
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod 0df829e
add useMemo comment in useFilterFormValues
LukasMod 2a08b4e
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod c1b1092
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod 8405e4a
update naming
LukasMod 8548a79
add defaultExpensifyCardSelector test
LukasMod d589ead
Create Card selectors
LukasMod ef0b684
add nonPersonalAndWorkspaceCardList unit tests
LukasMod 9b68bf9
add Card selector tests
LukasMod fea489c
prettier and typecheck fix
LukasMod 0620944
fix flaky tests
LukasMod e694a16
Merge branch 'main' of github.com:callstack-internal/Expensify-App in…
LukasMod 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
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
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.
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.
Are you sure that
useMemoreally improves performance?Not sure why React compiler doesn't handle it already.
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 did few tests with it, from compiler side it looks like that:
entry code:
result:
taxRatesrecomputes every time something in the region is outdated, buttaxRatesMemorecomputes only when additionallypoliciesare outdated, which makes that differenceThere 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 also added some logs inside
mergeCardListWithWorkspaceFeedsto compare how many times it fires from that hook and there is a difference (same cause)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.
@chrispader do you have any idea?
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 checked with logs again and
using just
generated 2x of each execution, when opening report. With useMemo its 0. Here is source output with and without memo:
useFIlterFormValues - NO MEMO.txt
useFIlterFormValues - MEMO.txt
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.
Interesting, not sure why React Compiler seems to not memoize most ideally in this case. Maybe this is a bug or React Compiler just decided, that the function is cheap to execute and therefore skips optimization.
@LukasMod do you have a working repro for this so we could investigate this further and potentially create an upstream issue?
also cc @roryabraham
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 added comment as @chrispader suggested here https://callstack-hq.slack.com/archives/C05LX9D6E07/p1768910560155529?thread_ts=1768850680.184809&cid=C05LX9D6E07
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.
@chrispader You can just take useFilterFormValues and remove that useMemo and check how source files looks like. From what I understand from output, compiler creates area for returned value
formValuesand its all dependencies.For useMemo compiler emits three separate memoized regions:
taxRatesmemoized on[policies]allCardsmemoized on[(workspaceCardFeeds ?? CONST.EMPTY_OBJECT), userCardList]formValuesmemoized on[allCards, allReports, currencyList, personalDetails, policyCategories, policyTagsLists, queryJSON, taxRates]So each derived value can be reused independently.
Without useMemo compiler emits one single memoized region around the entire derivation:
formValuesmemoized on[allReports, currencyList, personalDetails, policies, policyCategories, policyTagsLists, queryJSON, userCardList, workspaceCardFeeds]Inside that one region it recomputes
taxRatesandallCardstogether, whenever any dependency changes.Updated files from latest main, you can see changes in region condition:

useFIlterFormValues.-.MEMO.txt
useFIlterFormValues.-.NO.MEMO.txt
useFilterFormValues for testing (just check with useMemo and without):
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.
Any luck looking into this @chrispader ?