Skip to content

Add Workspace navigation suggestions to Search Router - #97972

Merged
carlosmiceli merged 24 commits into
Expensify:mainfrom
nabi-ebrahimi:92752-workspace-navigation-suggestions
Sep 3, 2026
Merged

Add Workspace navigation suggestions to Search Router#97972
carlosmiceli merged 24 commits into
Expensify:mainfrom
nabi-ebrahimi:92752-workspace-navigation-suggestions

Conversation

@nabi-ebrahimi

@nabi-ebrahimi nabi-ebrahimi commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Adds accessible Workspace pages to Search Router using the shared Workspace menu source.

Workspace suggestions:

  • Respect existing workspace access, feature, and visibility rules.
  • Display the workspace avatar and name.
  • Match a workspace name to its Overview page only.
  • Support the exact HR query.
  • Keep results alphabetically ordered.
  • Synchronize the Workspace LHN, title, and content when navigating between workspaces.

Fixed Issues

$ #92752
PROPOSAL: #92752 (comment)

Tests

  1. Search for a Workspace page

    1. Open Search Router.
    2. Search for members.
    3. Select a Workspace Members result.
    4. Verify the correct workspace Members page opens and the workspace avatar/name is shown in the result.
  2. Search by workspace name

    1. Open Search Router.
    2. Search for a workspace name.
    3. Verify only that workspace's Overview result matches its name.
    4. Verify unrelated workspace subpages are not shown.
  3. Search for HR

    1. Open Search Router.
    2. Search for HR.
    3. Verify accessible Workspace HR results appear.
  4. Switch between workspaces

    1. On a wide layout, open a subpage in Workspace A.
    2. Open Search Router and select a page in Workspace B.
    3. Verify the content, workspace title, and Workspace LHN all update to Workspace B.
    4. Repeat using the same subpage in both workspaces.
  5. Verify visibility rules

    1. Disable a Workspace feature such as Workflows.
    2. Search for that page.
    3. Verify the disabled page is not suggested.
    4. Verify inaccessible or deleted workspaces are not suggested.
  • Verify that no errors appear in the JS console

Offline tests

Same as the Tests.

QA Steps

Same as the Tests.

// TODO: These must be filled out, or the issue title must include "[No QA]."

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Screen.Recording.2026-08-07.at.9.20.16.PM.mov
Android: mWeb Chrome
Recording_20260807_204348.mp4
iOS: Native
Screen.Recording.2026-08-07.at.9.31.59.PM.mov
iOS: mWeb Safari
Screen.Recording.2026-08-07.at.9.33.11.PM.mov
MacOS: Chrome / Safari
  1. Search for a Workspace page
Screen.Recording.2026-08-07.at.8.39.16.PM.mov
  1. Search by workspace name
Screen.Recording.2026-08-07.at.8.39.48.PM.mov
  1. Search for HR
Screen.Recording.2026-08-07.at.8.40.41.PM.mov
  1. Switch between workspaces
Screen.Recording.2026-08-07.at.8.41.54.PM.mov
  1. Verify visibility rules
Screen.Recording.2026-08-07.at.8.42.53.PM.mov

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.

Files with missing lines Coverage Δ
...ponents/Search/SearchRouter/SearchRouterHelpers.ts 97.91% <100.00%> (+0.13%) ⬆️
...gation/helpers/navigateToWorkspaceSettingsRoute.ts 93.54% <93.54%> (ø)
...s/Search/SearchRouter/useNavigationSuggestions.tsx 92.85% <76.66%> (-7.15%) ⬇️
... and 7 files with indirect coverage changes

@nabi-ebrahimi
nabi-ebrahimi marked this pull request as ready for review August 8, 2026 06:21
@nabi-ebrahimi
nabi-ebrahimi requested review from a team as code owners August 8, 2026 06:21
@melvin-bot
melvin-bot Bot requested review from heyjennahay and marufsharifi and removed request for a team August 8, 2026 06:21
@melvin-bot

melvin-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

@marufsharifi 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]

Comment thread src/components/Search/SearchRouter/useNavigationSuggestions.tsx

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 952b0a632f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/components/Search/SearchRouter/useNavigationSuggestions.tsx Outdated
@nabi-ebrahimi

Copy link
Copy Markdown
Contributor Author

@marufsharifi, I’ve addressed the AI review comments above. Thanks!

@carlosmiceli

Copy link
Copy Markdown
Contributor

@nabi-ebrahimi there also seem to be conflicts 🙏

@nabi-ebrahimi

Copy link
Copy Markdown
Contributor Author

@nabi-ebrahimi there also seem to be conflicts 🙏

Done, thanks!

Comment thread src/components/Search/SearchRouter/navigateToWorkspaceSettingsRoute.ts Outdated
Comment thread src/components/Search/SearchRouter/navigateToWorkspaceSettingsRoute.ts Outdated
Comment thread src/components/Search/SearchRouter/navigateToWorkspaceSettingsRoute.ts Outdated
Comment thread src/components/Search/SearchRouter/useNavigationSuggestions.tsx
Comment thread src/components/Search/SearchRouter/useNavigationSuggestions.tsx Outdated
@marufsharifi

Copy link
Copy Markdown
Contributor

@MelvinBot Review

@MelvinBot

Copy link
Copy Markdown
Contributor

Review

Solid refactor — extracting the workspace menu into getWorkspaceMenuItems.ts and reusing it in both WorkspaceInitialPage and the Search Router is a clean way to keep the two menus in sync, and the visibility/access gating is preserved faithfully. One item is a must-fix before this merges; the rest are the already-open review threads, which are still unaddressed at 25eec14.

🔴 Must fix — dead / misleading transition guard. In navigateToWorkspaceSettingsRoute.ts, getWorkspaceRouteSuffix ends with return match?.[1] ?? '';, so it always returns a string — never undefined. That makes the targetSuffix !== undefined check on line 78 a constant true, and targetSuffix is used nowhere else — the whole helper is dead. The transition decision therefore rests only on the active route and never validates that targetRoute is a workspace route. It's masked today because every caller passes a workspace route, but if this exported helper is reused with a non-workspace target it would forceReplace + setParams a policyID onto a mismatched screen. Gate on the target instead and delete the helper:

const isWorkspaceSettingsTransition =
    WORKSPACE_ROUTE_PATTERN.test(targetRoute) && activeRoute !== targetRoute && WORKSPACE_ROUTE_PATTERN.test(activeRoute);
// then remove getWorkspaceRouteSuffix (25–29) and targetSuffix (77)

🟡 Still open from the earlier threads (unaddressed at 25eec14):

  • activeRoute param-stripped but compared to raw targetRouteline 76/78. Fine for today's query-less workspace routes, but WORKSPACE_WORKFLOWS.getRoute can append a ?tab= query — normalize targetRoute the same way or add a one-line "targets have no query param" comment.
  • WorkspaceContext is a misleading name for a presentational avatar+name cell — useNavigationSuggestions.tsx:124. Rename to something like WorkspaceSuggestionCell so it isn't confused with a real React Context.
  • Hand-rolled NavigationRouteWithState duplicates React Navigation's state typing — line 13. Non-blocking, but reusing the real navigator types would catch future state-shape changes at compile time.

🟡 One addition — the suggestion path computes indicators it never renders. buildWorkspaceNavigationItems calls the full getWorkspaceMenuItems per accessible policy, which runs every error-indicator check (shouldShowSyncError, hasPolicyCategoriesError, shouldShowTaxRateError, the highlighted/badgeText computation, etc.), but the resulting SearchQueryItem only consumes text/singleIcon/action/rightElement/matchTermsbrickRoadIndicator, highlighted, and badgeText are all discarded. Combined with a <WorkspaceContext> element materialized per row before any query filtering, a High-Traffic account (many workspaces) does this on every debounced query change. This reinforces the open memoization thread — please confirm React Compiler memoizes this file so it only re-materializes when policies/betas/layout change, not on each keystroke:

npm run react-compiler-compliance-check check-changed
Notes
  • The !policy.isJoinRequestPending filter and the name-match-only-on-Overview (screenName === SCREENS.WORKSPACE.PROFILE) behavior both look correct and match the PR's stated goals.
  • I attempted a web smoke test of the Search Router suggestions, but the test session rendered a blank page for the whole run — a CI/test-infra issue unrelated to this PR — so the flow was not exercised end-to-end. Worth a manual pass on tests 1–4 given the codecov drop on useNavigationSuggestions.tsx (-11.3%) and navigateToWorkspaceSettingsRoute.ts (78% patch coverage), some of which is the dead helper above.

@nabi-ebrahimi

Copy link
Copy Markdown
Contributor Author

@marufsharifi, all review comments have been addressed or clarified, and the focused checks pass. Could you please take another look? Thanks!

@trjExpensify

Copy link
Copy Markdown
Contributor

Nice. Same here, @marufsharifi. Let's get these re-reviews done tomorrow!

@marufsharifi

Copy link
Copy Markdown
Contributor

This is almost done, i will finish this before afternoon.

@marufsharifi

marufsharifi commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-08-20.at.10.59.47.AM.mov
Android: mWeb Chrome
Screen_Recording_20260820_110428_Chrome.mp4
iOS: HybridApp
Screen.Recording.2026-08-20.at.11.27.13.AM.mov
iOS: mWeb Safari
Screen.Recording.2026-08-20.at.11.30.18.AM.mov
MacOS: Chrome / Safari
Screen.Recording.2026-08-20.at.10.41.38.AM.mov
Screen.Recording.2026-08-20.at.10.43.52.AM.mov
Screen.Recording.2026-08-20.at.10.44.51.AM.mov
Screen.Recording.2026-08-20.at.10.46.28.AM.mov
Screen.Recording.2026-08-20.at.10.47.49.AM.mov

@carlosmiceli

Copy link
Copy Markdown
Contributor

@nabi-ebrahimi there seems to be confclits 🙏

@nabi-ebrahimi

Copy link
Copy Markdown
Contributor Author

@nabi-ebrahimi there seems to be confclits 🙏

@carlosmiceli sorry for the delay, resolved the conflicts.

This failure is also unrelated to this PR.

@carlosmiceli

Copy link
Copy Markdown
Contributor

@nabi-ebrahimi tests are failing now 🫂

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🚧 trjExpensify has triggered a test Expensify/App build. You can view the workflow run here.

@github-actions

This comment has been minimized.

@trjExpensify

Copy link
Copy Markdown
Contributor

Ran a build on this to confirm the navigation from inside the workspace editor doesn't have the same bug as domains found here. Confirmed it doesn't. 👍

@marufsharifi

Copy link
Copy Markdown
Contributor

@nabi-ebrahimi, could you please merge the main? thanks.

@marufsharifi

Copy link
Copy Markdown
Contributor

@carlosmiceli, the test failure was already present on main, so I believe we can proceed with merging this. Thanks!

@carlosmiceli

Copy link
Copy Markdown
Contributor

@nabi-ebrahimi let's do one more main merge to see if it fixes the test, we'll merge if not anyway,.

@nabi-ebrahimi

Copy link
Copy Markdown
Contributor Author

@carlosmiceli, I merged the main, and everything passed successfully. All yours now. Thanks!

@carlosmiceli
carlosmiceli merged commit bcf57a8 into Expensify:main Sep 3, 2026
34 of 35 checks passed
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚧 carlosmiceli has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.4.70-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Yes, help site changes are required. Draft PR: #100345

docs/articles/new-expensify/getting-started/Navigating-New-Expensify.md was the only article covering Search navigation suggestions, and its How to jump to a destination using Search section listed only the top-level destinations (Home, Inbox, Spend, Workspaces, Account). The Workspace pages this PR adds were undocumented, so I updated that article.

What the docs PR changes

  • New How to open a workspace settings page using Search section — steps, the Go to [page name] result wording, the workspace avatar and name on each row, the page-name-then-workspace-name sort order, and the fact that a workspace name matches only that workspace's Overview page.
  • New What determines which workspace settings pages appear in Search section — membership and role access, the More features requirement, exclusion of inaccessible/deleted/pending-join workspaces, the exact-match rule for page names under three characters (HR), and the eight-result limit.
  • Updated the existing jump-to-destination steps and added three FAQ entries plus refreshed metadata.

No new article, so docs/redirects.csv and the docs routes are unchanged. npm run spell-changed passed.

UI labels verified in the live app (not taken from the diff)

I drove NewDot on web to confirm every label used in the article:

  • The suggestion prefix is exactly Go to [destination] (search.goToGo to ${destination}).
  • Workspace settings page labels: Overview, Members, Rooms, Reports, Categories, Workflows, Company cards, More features. Note workspace.common.profile renders as Overview, not "Profile".
  • Typing members produced a Go to Members row with the workspace avatar and name on the row.
  • Typing the workspace name produced Go to Overview only — no other subpages, matching the matchTerms logic in buildWorkspaceNavigationItems.
  • Typing HR produced no Go to row on a workspace with the HR feature off, which is the visibility rule working as intended.
Search suggestions for members including Go to Members row Search suggestions for workspace name including Go to Overview row Workspace left-hand settings menu with all 8 labeled tabs Search suggestions for HR showing no Go to row Search opened with placeholder and Recent searches/Recent chats sections

⚠️ I could not assign the docs PR to you. GitHub reports nabi-ebrahimi is not an assignable user on Expensify/App — your permission on the repo is read, and assignees need push access. The HelpDot label was applied and PullerBear is requested as reviewer. Someone with write access will need to add you as assignee if you want that.

@nabi-ebrahimi, please review the linked help site PR and confirm it reflects the current behavior. Then mark the linked help site PR Ready for review


view run

@OSBotify

OSBotify commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/carlosmiceli in version: 9.4.72-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@mitarachim

Copy link
Copy Markdown

Deploy Blocker #100369 was identified to be related to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants