Skip to content

User list item decomposition - #100306

Merged
roryabraham merged 7 commits into
Expensify:mainfrom
software-mansion-labs:feat/user-list-item-decomposition
Sep 16, 2026
Merged

roryabraham merged 7 commits into
Expensify:mainfrom
software-mansion-labs:feat/user-list-item-decomposition

Conversation

@jmusial

@jmusial jmusial commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

Fixed Issues

$ #98361
PROPOSAL:

  • UserListItem, BareUserListItem, InviteMemberListItem now compose ListItemComposed primitives directly
  • new ReportAvatar / UserAvatar / WorkspaceAvatar, Row, InvitedSecondaryLoginFooter primitives.
  • ListItemContext now exposes isDisabled / isInteractive / shouldDisableAccessibleGrouping;
  • Focus change: avatar borders and MemberRightIcon badge now key off isFocusVisible (same as row background) instead of logical isFocused. Fixes the active-colored avatar ring / badge on an initially-focused row that isn't highlighted yet.
  • shouldShowRBRIndicator util gates the RBR dot at all call sites.
  • Dead list-level shouldShowRightCaret plumbing removed.

Tests

Scenario 1: focus styling
0. Pre requisite: Workspace with an approver already set.

  1. Open app
  2. Navigate to Workspace settings -> Categories -> any category -> Approver
  3. Verify that the current approver row is not highlighted and its role badge (Admin/Owner) looks like every other row
  4. On web: Hover or navigate with arrows and verify that row background, avatar border and badge highlight together on the keyboard-focused row

Scenario 2: user rows

  1. Open app
  2. Navigate to Workspace settings -> Workflows -> enable "Payments" > Authorized payer
  3. Verify that each row shows avatar, name, email and a radio button on the right, with the current payer selected

Offline tests

Same as tests

QA Steps

Same as tests

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-09-08.at.14.51.31.mov
Android: mWeb Chrome
Screen.Recording.2026-09-08.at.14.52.37.mov
iOS: Native
Screen.Recording.2026-09-08.at.14.38.17.mov
iOS: mWeb Safari
Screen.Recording.2026-09-08.at.14.39.10.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-08.at.14.13.31.mov

@codecov

codecov Bot commented Sep 3, 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 Δ
...arch/SearchList/ListItem/ExpenseReportListItem.tsx 0.00% <ø> (ø)
...Search/SearchList/ListItem/SearchQueryListItem.tsx 100.00% <100.00%> (ø)
src/components/SelectionList/BaseSelectionList.tsx 83.64% <ø> (+0.53%) ⬆️
...onents/SelectionList/ListItem/BareUserListItem.tsx 100.00% <100.00%> (ø)
...components/SelectionList/ListItem/BaseListItem.tsx 78.78% <100.00%> (-6.72%) ⬇️
...components/SelectionList/ListItem/CardListItem.tsx 0.00% <ø> (ø)
...ts/SelectionList/ListItem/InviteMemberListItem.tsx 100.00% <100.00%> (ø)
...onents/SelectionList/ListItem/ListItemRenderer.tsx 85.71% <ø> (ø)
...ents/SelectionList/ListItem/SelectableListItem.tsx 100.00% <100.00%> (ø)
...components/SelectionList/ListItem/UserListItem.tsx 100.00% <100.00%> (ø)
... and 18 more
... and 821 files with indirect coverage changes

@jmusial

jmusial commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@codex review
@MelvinBot review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: cc3ff0b896

ℹ️ 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".

@MelvinBot

MelvinBot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review

I traced the before/after render tree for every row this touches and found no correctness regressions. The RBR gating in ListItemRBRIndicator.tsx:28 reproduces the old expressions exactly, shouldShowSelectionButton reproduces the old BaseListItem/SelectableListItem fork, and no remaining caller passes FooterComponent, shouldDisplayRBR, or render-prop children to SelectableListItem. Test coverage added here is good.

Two things worth answering before merge, then some cleanups.

1. Focus source silently changed from logical to visual focus

Avatar borders used to key off isFocused; they now key off isFocusVisible via useListItemAvatarColors.ts:20. Same for the member role badge at MemberRightIcon.tsx:23, which lost its isFocusVisible ?? isFocused fallback.

These are not the same value — isFocusVisible lags logical focus (see BaseSelectionList's isItemVisuallyFocused). So on the initially-focused row, the subscript avatar border and the Admin/Owner badge highlight will no longer show until the user starts keyboard-navigating. It reads as intentional (it makes them match the row background), but nothing in the PR says so. Please confirm and add it to the test steps.

2. List-level shouldShowRightCaret is now inert for every SelectableListItem row

BaseSelectionList.tsx:325ListItemRenderer.tsx:116 still forwards the prop, and it's still declared in the props types, but SelectableListItem now drops it. No caller passes it today so nothing breaks — but leaving inert plumbing in place is how the next bug gets written. Either remove the plumbing or keep honoring it.

Related: the Omit at SelectableListItem.tsx:48 belongs in the type declaration, not the function signature. As written, SelectableListItemProps still advertises shouldShowRightCaret, and so does CardListItemProps, which aliases it. Fold it into the existing Omit at types.ts:374 next to children/FooterComponent/shouldDisplayRBR.

Cleanups and nits

Selection button is now copy-pasted three times. SelectableListItem.tsx:51, UserListItem.tsx:45, and InviteMemberListItem.tsx:97 each repeat the !item.shouldHideSelectionButton gate and the RIGHT ? ml3 : mr3 style. Both belong inside the primitive — give it a position prop and let it self-gate, the same way RBRIndicator now self-gates. Each call site then becomes one line.

The people-row style array is duplicated four times. UserListItem.tsx:72, BareUserListItem.tsx:60, InviteMemberListItem.tsx:60, CardListItem.tsx:81. A ListItemComposed.Row primitive (or a single named style) would carry the row layout the way the other primitives carry theirs.

shouldDisableAccessibleGrouping: accessible === false conflates two concerns. ListItemPressable.tsx:214 infers "content should group itself" from an unrelated prop. Any row that sets accessible={false} for a different reason — ExpenseReportListItem does exactly that for iOS — would flip UserListItemContent's role to BUTTON. Nothing overlaps today, so this is a latent coupling, not a bug. An explicit prop on the pressable would be safer.

RBRIndicator now mounts on every row. ListItemRBRIndicator.tsx:24 calls useMemoizedLazyExpensifyIcons — which holds useState + useEffect — before the null guard on line 28. SelectableListItem previously mounted it only when the dot actually showed, so on a cold icon chunk every row in every selection list now takes an extra re-render. Perf tests passed, so this is small, but splitting the guard into a hook-free wrapper around an inner component costs nothing.

PR body

Explanation of Change is empty and there are no Tests, QA steps, or screenshots. For a refactor reaching UserListItem and InviteMemberListItem — workspace members, invite flows, approver pickers, participant pickers, card lists — a reviewer can't tell what to re-test. Please at least list the affected surfaces and the focus/hover states from item 1.


Next Steps: Reply with @MelvinBot <your feedback> to dig into any of these.


view run · no recording available

@jmusial

jmusial commented Sep 8, 2026

Copy link
Copy Markdown
Contributor Author

@MelvinBot review again

@MelvinBot

MelvinBot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Re-review of a0f4627

All five actionable items from my last pass are fixed, and cleanly. One question from that review is still open, plus one new minor note.

What I verified on the fixes
  • shouldShowRightCaret plumbing removed end to end — gone from SelectionListProps, CommonListItemProps, ListItemProps, BaseListItemProps, BaseSelectionList, ListItemRenderer, and BaseListItem's render. The only survivors are the item-level ListItem.shouldShowRightCaret flag and its one consumer in UserListItemContent, which is correct. No caller was relying on the list-level prop, so nothing regresses. BaseListItem's icon set correctly narrowed to ['DotIndicator'] and no import is stranded.
  • RBR gating extracted to shouldShowRBRIndicator.ts:7. It's boolean-identical to the four expressions it replaces, including BaseListItem's shouldDisplayRBR && prefix. This also resolves the perf note — the primitive's useMemoizedLazyExpensifyIcons now only runs when the dot actually renders. Nice unit test on the util too.
  • ListItemComposed.Row + styles.listItemRow — I flattened the old array (flex1 + justifyContentBetween + sidebarLinkInner + userSelectNone + peopleRow) against styles/index.ts:3709 and they resolve to the same computed style. sidebarLinkInner's paddingLeft/Right: 20 and peopleRow's ph5 were already the same 20px, so collapsing to ph5 is a no-op.
  • Selection button position moved into the primitive at ListItemSelectionButton.tsx:40LEFT ? mr3 : ml3 matches the old RIGHT ? ml3 : mr3 for both enum values.
  • SelectableListItemProps Omit now lives in the type, so CardListItemProps no longer advertises a dropped prop.

Everything else I checked last time still holds: child order, accessible/testID placement, hover and disabled derivation, and the InviteMemberListItem selection-button fork are all behavior-preserving. All CI green except the two checklist checks.

Still open: the focus-highlight change

MemberRightIcon.tsx:23 and useListItemAvatarColors.ts:20 still switch from logical focus (isFocused) to visual focus (isFocusVisible). Those differ — isFocusVisible lags, per BaseSelectionList's isItemVisuallyFocused — so the Admin/Owner badge and the subscript avatar border on the initially-focused row will no longer highlight until the user starts keyboard-navigating.

I still think it's the right change (it makes them match the row background), but it's the one user-visible difference in this PR and it isn't captured anywhere. Please confirm it's intended and put it in the test steps.

New minor note

Splitting listItemRow off from peopleRow leaves ListHeader.tsx:108 as the last peopleRow consumer. The header and the rows have to keep the same width and horizontal padding to stay column-aligned; they do today, but that's now an implicit contract between two independent styles. A comment on each pointing at the other would be enough.

Optional, carried over: shouldDisableAccessibleGrouping: accessible === false at ListItemPressable.tsx:214 still infers one concern from an unrelated prop. Nothing overlaps today.

PR body

Unchanged since last review — Explanation of Change is empty, and there are no Tests, QA steps, or screenshots. This is a pure refactor across UserListItem, BareUserListItem, InviteMemberListItem, CardListItem, and SelectableListItem, which between them cover workspace members, invite and approver flows, participant pickers, and card lists. A reviewer can't tell what to re-test without that list.


Next Steps: Reply with @MelvinBot <your feedback> to dig into any of these.


view run · view recording

@jmusial
jmusial marked this pull request as ready for review September 8, 2026 12:54
@jmusial
jmusial requested review from a team as code owners September 8, 2026 12:54
@melvin-bot
melvin-bot Bot requested review from trjExpensify and truph01 and removed request for a team September 8, 2026 12:54
@melvin-bot

melvin-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

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

@melvin-bot
melvin-bot Bot removed the request for review from a team September 8, 2026 12:54
Comment thread src/components/SelectionList/ListItemComposed/primitives/ListItemReportAvatar.tsx Outdated

@trjExpensify trjExpensify 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.

It's a shame you can't see the full email addresses here. Do they at least appear on hover?

Image

@jmusial

jmusial commented Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

It's a shame you can't see the full email addresses here. Do they at least appear on hover?

yup

image

Comment thread src/components/SelectionList/ListItem/InviteMemberListItem.tsx Outdated
@truph01

truph01 commented Sep 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 any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • 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 and each prop has a /** comment above it */
    • The file is named correctly
    • 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
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • 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 any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • 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-09-12.at.01.13.43.mov
Android: mWeb Chrome
Screen.Recording.2026-09-12.at.01.15.01.mov
iOS: HybridApp
iOS: mWeb Safari
Screen.Recording.2026-09-12.at.01.16.30.mov
MacOS: Chrome / Safari
Screen.Recording.2026-09-12.at.01.05.55.mov
Screen.Recording.2026-09-12.at.01.08.10.mov

@melvin-bot
melvin-bot Bot requested a review from roryabraham September 14, 2026 08:52
@roryabraham
roryabraham merged commit 7c79ac3 into Expensify:main Sep 16, 2026
36 of 39 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

🚧 roryabraham 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/roryabraham in version: 9.4.81-0 🚀

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

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 No help site changes are required for this PR. I did not create a docs PR.

Why: this is an internal refactor of the SelectionList list item components. Nothing users read or click changed, so nothing in docs/articles goes stale.

What I checked

Every changed file is component plumbing, styles, or tests:

  • Decomposition onlyUserListItem, BareUserListItem, and InviteMemberListItem now compose ListItemComposed primitives (ListItemReportAvatar, ListItemUserAvatar, ListItemWorkspaceAvatar, ListItemRow, ListItemInvitedSecondaryLoginFooter). Same rendered output, different internal structure.
  • No copy changes — no src/languages/*.ts file is touched. The only translation call in the diff, workspace.people.invitedBySecondaryLogin, was moved into a new primitive unchanged. No new or reworded labels, buttons, tab names, or settings names.
  • No new or removed user-facing feature — no new setting, page, or flow that a help article would need to describe.
  • Focus styling fix is presentational — avatar borders and the MemberRightIcon badge now key off isFocusVisible instead of logical isFocused, so an initially-focused row no longer shows an active-colored ring before it is highlighted. Help articles document what a feature does, not row highlight states, so there is nothing to update.

The linked issue, [SelectionList ListItem] PR 4 — Avatar resolvers + UserListItem family, confirms the scope: it is PR 4 of the SelectionList ListItem — Composition over Configuration tracking effort, an architecture cleanup with drift fixes.

@jmusial, since no help site PR was needed, there is nothing for you to review. If you believe a specific article does need updating here, reply with which article and what changed, and I'll open the draft PR.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.81-1 🚀

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

1 similar comment
@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.4.81-1 🚀

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

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.

6 participants