Conversation
|
@mananjadhav 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] |
| const route = useRoute(); | ||
|
|
||
| // Extract reportID from the current path | ||
| const reportID = useMemo(() => { |
There was a problem hiding this comment.
❌ CLEAN-REACT-PATTERNS-0 (docs)
React Compiler is enabled in this codebase and automatically memoizes derived values. The useMemo wrapping the regex-based reportID extraction is redundant because the compiler will automatically cache this computation based on its dependency (route.path). Manual memoization adds noise and interferes with the compiler's optimization model.
Remove the useMemo wrapper and compute reportID directly:
const currentPath = route.path ?? '';
const match = currentPath.match(/\/r\/([^/]+)/);
const reportID = match ? match[1] : '';Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
|
|
||
| if (isLoading) { | ||
| return <FullscreenLoadingIndicator />; | ||
| } |
There was a problem hiding this comment.
❌ UI-1 (docs)
FullscreenLoadingIndicator is used in an early return with no navigation component (no HeaderWithBackButton, no close button) in the same conditional branch. If loading hangs, the user is trapped with no way to escape. The shouldUseGoBackButton prop enables an emergency "Go Back" button that appears after a timeout.
Add shouldUseGoBackButton to the loading indicator:
if (isLoading) {
return <FullscreenLoadingIndicator shouldUseGoBackButton />;
}Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
|
@collectioneur @mananjadhav Please help review this PR. One thing to note is that the dynamic page can't get the report ID from the HOC component(withReportOrNotFound), so I created a new hook to handle this. Do you have any other ideas for this? |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 585e4f32ad
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Extract reportID from the current path | ||
| const reportID = useMemo(() => { | ||
| const currentPath = route.path ?? ''; | ||
| const match = currentPath.match(/\/r\/([^/]+)/); |
There was a problem hiding this comment.
Parse report IDs from search report dynamic routes
useReportFromDynamicRoute only extracts IDs from paths matching /r/:reportID, but this dynamic route is explicitly allowed from SCREENS.RIGHT_MODAL.SEARCH_REPORT, whose URL shape is search/view/:reportID (ROUTES.SEARCH_REPORT). For URLs like /search/view/123/settings/name, reportID becomes empty and isLoading stays true because of !reportID, leaving the page stuck on the loading indicator.
Useful? React with 👍 / 👎.
| if (isEmptyObject(report)) { | ||
| return <FullPageNotFoundView shouldShow />; |
There was a problem hiding this comment.
Keep report access guards on dynamic name page
This page now treats any non-empty report object as valid and immediately renders edit screens, but it no longer applies the withReportOrNotFound checks that previously enforced canAccessReport (including errorFields.notFound handling). If a cached report contains a not-found/access-restricted state, users can still reach the rename UI instead of being blocked by NotFound behavior.
Useful? React with 👍 / 👎.
Hi! Thanks for working on this. I was looking at the code and I think we might be able to simplify it. Instead of adding a new hook, we could just propagate the parameters from the base route to the dynamic route, and let |
|
@collectioneur To be honest, I created this hook mainly to start the discussion and explore possible solutions. I’ve reviewed your draft PR and I completely agree with your approach. |
| function getStateForDynamicRoute(path: string, dynamicRouteName: keyof typeof DYNAMIC_ROUTES, parentRouteParams?: Record<string, unknown>) { | ||
| const routeConfig = getRouteNamesForDynamicRoute(DYNAMIC_ROUTES[dynamicRouteName].path); | ||
| const [, query] = splitPathAndQuery(path); | ||
| const params = getParamsFromQuery(query); |
There was a problem hiding this comment.
@collectioneur How about const params = getParamsFromQuery(query);? Do we still need this?
There was a problem hiding this comment.
I think we do need to keep this. Dynamic routes can also have query parameters, and this seems to be the most reliable way to extract them
|
I've opened a PR that handles parameter propagation |
Yeah, I cherry-picked your commit from the draft PR. No worries, once you merge that branch into main, I’ll update/rebase this branch accordingly. |
Explanation of Change
Fixed Issues
$ #83368
PROPOSAL:
Tests
Same QA step
Offline tests
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
Screen.Recording.2026-03-12.at.15.28.51.mov
Android: mWeb Chrome
Screen.Recording.2026-03-12.at.15.27.48.mov
iOS: Native
Screen.Recording.2026-03-12.at.15.23.57.mov
iOS: mWeb Safari
Screen.Recording.2026-03-12.at.15.25.07.mov
MacOS: Chrome / Safari
Screen.Recording.2026-03-12.at.15.22.05.mov