Skip to content

Move short mention logins cache out of PersonalDetailsUtils - #98157

Merged
Valforte merged 3 commits into
Expensify:mainfrom
callstack-internal:fix-task-assignee-onyx
Aug 11, 2026
Merged

Move short mention logins cache out of PersonalDetailsUtils#98157
Valforte merged 3 commits into
Expensify:mainfrom
callstack-internal:fix-task-assignee-onyx

Conversation

@adhorodyski

@adhorodyski adhorodyski commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Follow-up to #96500, addressing this review comment from @bernhardoj.

#96500 added an allPersonalDetailLogins cache to the PERSONAL_DETAILS_LIST Onyx.connect in PersonalDetailsUtils. That subscription is being removed by #66391, so a new consumer on it sets that refactor back.

This moves the cache into its own thin store, src/libs/ShortMentionLogins.ts, following the existing src/libs/CurrentUserStore.ts pattern. PersonalDetailsUtils returns to its pre-#96500 shape; the two call sites (ReportUtils.getParsedComment and useComposerSubmit) import from the new module instead.

Two notes on the shape:

  • The new store subscribes with Onyx.connectWithoutView, which react-native-onyx's own typings recommend over connect ("This method will be deprecated soon"). It is also outside rulesdir/no-onyx-connect, so this adds no seatbelt entry and no new lint debt.
  • The list can't come from a hook yet. getParsedComment resolves short mentions from non-React code and has around thirty callers; until those thread personal details in themselves, a module-level read is the only option. useComposerSubmit deliberately reads it imperatively at submit time so the composer input and send button don't subscribe to the personal details collection on render — that was part of fix: task assignee resolution for composer short mentions #96500 and is preserved here.

No behaviour change: same list, same construction, same consumers.

Fixed Issues

$ #96612
PROPOSAL:

Tests

Same as #96500, since behaviour is unchanged:

  1. Sign in with an account on a private email domain that shares the domain with a coworker (e.g. you@company.com and coworker@company.com).
  2. In any report, send [] @coworker Some task (short mention, without the domain).
  3. Verify the task "Some task" is created and assigned to the coworker.
  4. Send [] @nosuchuser Some task and verify the task is created unassigned, titled @nosuchuser Some task.
  5. Send a plain message containing @coworker and verify the mention renders as a resolved mention, not plain text.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests. Task creation is optimistic and works offline.

QA Steps

Same as Tests.

  • 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.
  • 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
  • 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
  • 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
  • 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
  • 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.

PR Expensify#96500 added an allPersonalDetailLogins cache to the
PERSONAL_DETAILS_LIST Onyx.connect in PersonalDetailsUtils. That
subscription is being removed by Expensify#66391, so the new consumer set that
refactor back.

Move the cache to its own thin store, ShortMentionLogins, following the
CurrentUserStore pattern, and subscribe with connectWithoutView since
Onyx documents connect as pending deprecation. PersonalDetailsUtils
returns to its pre-Expensify#96500 shape and the two call sites import from the
new module.

The list cannot come from a hook yet: getParsedComment resolves short
mentions from non-React code across roughly thirty callers.

No behaviour change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mountiny
mountiny marked this pull request as ready for review August 11, 2026 12:40
@mountiny
mountiny requested review from a team as code owners August 11, 2026 12:40
@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team August 11, 2026 12:40
@github-actions
github-actions Bot requested review from luacmartins and tgolen August 11, 2026 12:40
@github-actions

Copy link
Copy Markdown
Contributor

This PR adds a new Onyx.connectWithoutView call, so I've requested a review from the Onyx performance reviewers (@tgolen, @mountiny, @luacmartins) — a review from any one of them is enough. Please add a link in your PR description to the Slack discussion where the @frontend-performance team approved using connectWithoutView here.

@melvin-bot
melvin-bot Bot requested review from Valforte and removed request for a team August 11, 2026 12:40
@melvin-bot

melvin-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

@ZhenjaHorbach

ZhenjaHorbach commented Aug 11, 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
2026-07-21.15.44.00.mov
Android: mWeb Chrome
2026-07-21.15.34.17.mov
iOS: HybridApp
2026-07-21.15.44.00.mov
iOS: mWeb Safari
2026-07-21.15.34.17.mov
MacOS: Chrome / Safari
2026-08-11.15.42.50.mov

@ZhenjaHorbach

Copy link
Copy Markdown
Contributor

LGTM!

@Valforte

Copy link
Copy Markdown
Contributor

Verify peer review is stuck, so I'm gonna close and reopen the PR

@Valforte Valforte closed this Aug 11, 2026
@Valforte Valforte reopened this Aug 11, 2026

@mountiny mountiny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for cleaning this up

@Valforte
Valforte merged commit 62bf69d into Expensify:main Aug 11, 2026
47 of 49 checks passed
@OSBotify

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.

@github-actions

Copy link
Copy Markdown
Contributor

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

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/Valforte in version: 9.4.53-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 I reviewed the changes in this PR and no help site changes are required.

This is a pure internal refactor that moves the allPersonalDetailLogins cache out of PersonalDetailsUtils into its own thin store (src/libs/ShortMentionLogins.ts), following the existing CurrentUserStore pattern. All four changed files are internal TypeScript modules:

  • src/libs/PersonalDetailsUtils.ts
  • src/libs/ReportUtils.ts
  • src/libs/ShortMentionLogins.ts (new)
  • src/pages/inbox/report/ReportActionCompose/useComposerSubmit.ts

As the PR states, there is no behavior change — same list, same construction, same consumers. There's no new feature, no UI change, and no modified setting, label, or user-facing flow that would need to be documented in App/docs/articles. Accordingly, I did not create a draft docs PR — there's nothing to review on the help site for this change.

@adhorodyski, if you believe a customer-facing behavior did change here and warrants a docs update, let me know what it is and I'll draft the help site 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