Repository navigation
Pass NVPs to last accessed report calls #98719
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
blimpich
merged 35 commits into
Expensify:main
from
ShridharGoel:refactor/66422-last-accessed-report-nvp
Sep 22, 2026
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
ee4c182
Pass NVPs to last accessed report calls
ShridharGoel 44d2d8f
Fix report NVP collection name
ShridharGoel 1364c4a
Refresh warm-link report NVPs
ShridharGoel d74cca1
refactor(report-utils): return slice from findLastAccessedReport
ShridharGoel c6b9466
Merge origin/main into refactor/66422-last-accessed-report-nvp
ShridharGoel a74cc2f
refactor(report-utils): trim findLastAccessedReport comments
ShridharGoel 05b073c
refactor(report-utils): drop unused exports
ShridharGoel f6ce10d
Encapsulate last accessed report lookup in useFindLastAccessedReport …
ShridharGoel 3c15cfe
Trim verbose hook doc and drop stale pattern reference
ShridharGoel aee6b5c
Fix knip, eslint and typecheck on useFindLastAccessedReport
ShridharGoel 4c526cc
Merge duplicate ReportUtils type imports in navigateAfterOnboardingTest
ShridharGoel b69fe5d
Merge branch 'main' of github.com:Expensify/App into refactor/66422-l…
ShridharGoel 369410b
Pass last accessed report ID instead of NVP collection
ShridharGoel 6e9a90a
Derive last accessed report options inside the hook
ShridharGoel 95941fd
Look up last accessed report on leave and delete tap
ShridharGoel 6cea4b2
Merge remote-tracking branch 'origin/main' into refactor/66422-last-a…
ShridharGoel 5d2f9c3
Drop empty-string last accessed report IDs and rebuild GH action bundle
ShridharGoel 3c844a4
Merge remote-tracking branch 'origin/main' into refactor/66422-last-a…
ShridharGoel 7f3d858
Use nullish coalescing for last accessed report fallback
ShridharGoel 53f9832
Restore proposalPoliceComment GH action bundle from main
ShridharGoel 80b3704
Merge remote-tracking branch 'origin/main' into refactor/66422-last-a…
ShridharGoel 783faa9
Address review: hook returns reportID, drop selector layer, on-tap lo…
ShridharGoel 691a926
Merge branch 'main' of github.com:Expensify/App into refactor/66422-l…
ShridharGoel 491c6a4
Use useFindLastAccessedReport in navigator
ShridharGoel 6b1f247
Merge branch 'main' into refactor/66422-last-accessed-report-nvp
ShridharGoel 3cf5b60
Fix no-default-id-values in navigator
ShridharGoel f0e714f
Fix Link mock in DeepLinkHandlerTest
ShridharGoel 364edf1
Merge branch 'main' into refactor/66422-last-accessed-report-nvp
ShridharGoel 55099e7
Merge branch 'main' into refactor/66422-last-accessed-report-nvp
ShridharGoel cae920b
Fix formatting and drop unused navigator imports
ShridharGoel 1a0b6fe
Drop redundant excludeReportID from hook
ShridharGoel 35acbfc
Drop redundant openOnAdminRoom from navigator hook
ShridharGoel b56aeaf
Merge remote-tracking branch 'origin/main' into refactor/66422-last-a…
ShridharGoel 377c796
Merge remote-tracking branch 'origin/main' into refactor/66422-last-a…
ShridharGoel bdf90a8
Use line comments in useFindLastAccessedReport
ShridharGoel 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import shouldOpenOnAdminRoom from '@libs/Navigation/helpers/shouldOpenOnAdminRoom'; | ||
| import {findLastAccessedReport} from '@libs/ReportUtils'; | ||
|
|
||
| import CONST from '@src/CONST'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| import useOnyx from './useOnyx'; | ||
| import usePermissions from './usePermissions'; | ||
|
|
||
| type UseFindLastAccessedReportOptions = { | ||
| // Prefer the policy admins room when one exists. Defaults to the openOnAdminRoom URL param. | ||
| openOnAdminRoom?: boolean; | ||
| // When false, skip the lookup and return undefined without scanning reports. | ||
| enabled?: boolean; | ||
| }; | ||
|
|
||
| // Resolves the last accessed report for navigation fallbacks from a view-scoped subscription. | ||
| function useFindLastAccessedReport({openOnAdminRoom, enabled = true}: UseFindLastAccessedReportOptions = {}) { | ||
| const {isBetaEnabled} = usePermissions(); | ||
| const ignoreDomainRooms = !isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS); | ||
| const shouldPreferAdminRoom = openOnAdminRoom ?? shouldOpenOnAdminRoom(); | ||
| const [guideAccountIDs] = useOnyx(ONYXKEYS.DERIVED.GUIDE_ACCOUNT_IDS); | ||
| const [reportNameValuePairs, reportNameValuePairsMetadata] = useOnyx(ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS); | ||
| const [lastAccessedReportID, reportsMetadata] = useOnyx(ONYXKEYS.COLLECTION.REPORT, { | ||
| selector: (reports) => (enabled ? findLastAccessedReport(ignoreDomainRooms, guideAccountIDs, shouldPreferAdminRoom, undefined, reportNameValuePairs, reports)?.reportID : undefined), | ||
| }); | ||
| return {lastAccessedReportID, reportsMetadata, reportNameValuePairsMetadata}; | ||
| } | ||
|
|
||
| export default useFindLastAccessedReport; |
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.