Skip to content

Stop scroll jump on room invite member selection#91387

Merged
francoisl merged 11 commits into
mainfrom
claude-stopScrollJumpRoomInvite
May 22, 2026
Merged

Stop scroll jump on room invite member selection#91387
francoisl merged 11 commits into
mainfrom
claude-stopScrollJumpRoomInvite

Conversation

@MelvinBot
Copy link
Copy Markdown
Contributor

@MelvinBot MelvinBot commented May 22, 2026

Explanation of Change

Stop scrolling and jumping when selecting items on the Room Invite page (RoomInvitePage).

Previously, selected contacts were separated into a dedicated section at the top, and selecting a new contact triggered an auto-scroll to the top of the list. This was disorienting when selecting multiple contacts from a long list.

Changes:

  • Pass shouldKeepSelectedInAvailableOptions: true to usePersonalDetailSearchSelector so selected items remain in the Contacts section with their isSelected flag instead of being moved to a separate section
  • Compute selectedNonExistingOptions inside usePersonalDetailSearchSelector — selected users not present in availableOptions.personalDetails (e.g. typed email addresses). These are shown in a dedicated top section above Contacts so they remain visible after selection
  • Hide the userToInvite row when it is already selected to prevent duplicate entries
  • Add shouldUpdateFocusedIndex and shouldPreventAutoScrollOnSelect to the selection list to maintain scroll position when selecting items

This follows the same pattern applied in #91250 for DynamicWorkspaceInvitePage.

Fixed Issues

$ #61414
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console
  • Go to Inbox > any workspace room > header > room detail page > Members > Invite member
  • Scroll down the contacts list and select several contacts scattered throughout
  • Verify no scroll jump occurs when selecting each contact — the list stays at the same scroll position
  • Verify selected contacts show a checkmark but remain in-place in the Contacts section
  • Type an email address not in the contacts list (e.g. test@example.com) and select it
  • Verify the typed email appears in a section above Contacts and remains visible
  • Verify the "user to invite" row disappears after selecting it (no duplicate)
  • Tap "Invite" and verify all selected users are invited successfully

Offline tests

  • Go to Inbox > any workspace room > header > room detail page > Members > Invite member
  • Turn off network
  • Select multiple contacts from the list and verify no scroll jump occurs
  • Turn on network and verify the selections persist

QA Steps

  • Verify that no errors appear in the JS console
  • Go to Inbox > any workspace room > header > room detail page > Members > Invite member
  • Select multiple contacts from a long list and verify no scroll/jump behavior
  • Type a non-existing email address, select it, and verify it appears in the top section
  • Invite all selected users and verify success

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 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I used JaimeGPT to get English > Spanish translation. I then posted it in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • 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 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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

Screenshots will be provided in the reviewer checklist.

Android: Native

Will be added in reviewer checklist.

Android: mWeb Chrome

Will be added in reviewer checklist.

iOS: Native

Will be added in reviewer checklist.

iOS: mWeb Safari

Will be added in reviewer checklist.

MacOS: Chrome / Safari

Will be added in reviewer checklist.

AI Tests

Test Result
prettier ✅ Passed
lint-changed ✅ Passed
typecheck-tsgo ✅ Passed (pre-existing errors in unrelated files)
react-compiler-compliance-check ✅ Passed

Keep selected contacts in-place in the Contacts section instead of
moving them to a separate section at the top. This prevents the list
from jumping when selecting multiple contacts from different positions.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/hooks/usePersonalDetailSearchSelector/base.ts 93.84% <85.71%> (+92.12%) ⬆️
src/pages/RoomInvitePage.tsx 0.00% <0.00%> (ø)
... and 25 files with indirect coverage changes

Comment thread src/pages/RoomInvitePage.tsx Outdated
shouldKeepSelectedInAvailableOptions: true,
});

const selectedNonExistingOptions = availableOptions.extraOptions.filter((option) => option.isSelected);
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.

@MelvinBot move this logic to usePersonalDetailSearchSelector similar to useSearchSelector

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved selectedNonExistingOptions into usePersonalDetailSearchSelector — it's now computed inside the hook and returned directly, matching the useSearchSelector pattern.

Compute selectedNonExistingOptions inside the hook and return it,
matching the useSearchSelector pattern. Remove the external computation
from RoomInvitePage.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
setSelectedAccountIDs(new Set());
};

const selectedNonExistingOptions = extraOptions.filter((option) => option.isSelected);
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.

@MelvinBot this should filter out options mismatching search input value

See this bug:
Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed — selectedNonExistingOptions now filters by debouncedSearchTerm, matching how useSearchSelector filters selectedOptionsForDisplay by search input before computing non-existing options.

When a search term is active, filter out selected non-existing options
that don't match the search input, preventing mismatched options from
displaying in the results.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot when press Enter key twice while focused item with arrow key, Invite button is triggered instead of toggling checkbox twice. Can you investigate? This happens on production so out of scope but I prefer fixing this here.

Note: this doesn't happen on DynamicWorkspaceInvitePage. Why? What's the difference?

When the invite button was a sibling outside SelectionListWithSections,
its Enter key handler registered after the list's handler, putting it
at the top of the keyboard shortcut stack. This caused the second Enter
press to trigger the invite instead of toggling the checkbox.

Moving it into footerContent (as a child of the SelectionList) matches
the DynamicWorkspaceInvitePage pattern where child effects register
first, keeping the SelectionList's handler on top.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Root cause: The FormAlertWithSubmitButton was a sibling rendered after SelectionListWithSections, so its Enter key handler registered last in the keyboard shortcut stack, landing at the top. On the second Enter press, the Button's handler fired first and triggered the invite instead of letting the SelectionList toggle the checkbox.

Why DynamicWorkspaceInvitePage works: It passes the button as footerContent inside the SelectionList. React's effect order (children before parents) means the Button's handler registers first, and the SelectionList's handler ends up on top of the stack — so it fires first and correctly toggles the checkbox.

Fix: Moved FormAlertWithSubmitButton from a sibling into footerContent of SelectionListWithSections, matching the DynamicWorkspaceInvitePage pattern.

Key evidence

The handler registration in KeyboardShortcut/index.ts:150 uses splice(priority, 0, handler) — at the same priority, the last handler to register goes to index 0 (top of stack). The event loop in bindHandlerToKeydownEvent fires handlers top-to-bottom and stops when shouldBubble is false.

canSelectMultiple
footerContent={footerContent}
/>
<View style={[styles.flexShrink0]}>
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.

@MelvinBot the parent wrapper with styles.flexShrink0 style was not moved to footerContent.
Is it safe? Won't it cause any style regression?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's safe — no style regression. The footerContent prop is rendered inside FixedFooter, which already wraps children in a View with styles.flexShrink0. So the outer wrapper is redundant when using footerContent.

DynamicWorkspaceInvitePage follows the same pattern — it passes footerContent without an extra flexShrink0 wrapper.

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.

@MelvinBot ok but there's another style regression.

containerStyles={[styles.flexReset, styles.flexGrow0, styles.flexShrink0, styles.flexBasisAuto, styles.mb5, styles.ph5]}

styles.mb5, styles.ph5 seems duplicated

Screenshot 2026-05-22 at 7 18 19 AM

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed styles.mb5 and styles.ph5 from the FormAlertWithSubmitButton containerStyles. FixedFooter already applies ph5, so these were causing double padding. Now matches the DynamicWorkspaceInvitePage pattern.

Comment thread src/pages/RoomInvitePage.tsx Outdated
headerMessage: getHeaderMessageText(),
};

const footerContent = useMemo(
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.

@MelvinBot remove useMemo as this component is auto memoized by React Compiler

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed the useMemo wrapper from footerContent — React Compiler handles memoization automatically.

React Compiler auto-memoizes this component, making the manual
useMemo wrapper unnecessary.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

⚠️ MelvinBot CI Fix Loop Detected

MelvinBot has made 5 consecutive commits trying to fix CI failures. Automatic CI fix dispatches are now paused for this PR.

Next steps: A human should review the recent commits and resolve the conflicting CI errors manually.

FixedFooter already applies ph5, so having it in containerStyles too
caused double horizontal padding. Match the DynamicWorkspaceInvitePage
pattern which only uses flex-related container styles.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@mkhutornyi
Copy link
Copy Markdown
Contributor

@codex review

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot add unit tests

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Code Review

Two actionable issues found, plus some minor observations.

1. Bug: Missing isDisabled on confirmButtonOptions

RoomInvitePage.tsx:236-238 passes only onConfirm — no isDisabled. This means Ctrl+Enter fires inviteUsers even with zero selections (the function returns early but still cancels pending HTTP requests).

DynamicWorkspaceInvitePage.tsx:273-276 correctly passes isDisabled: !selectedOptions.length.

Fix: Add isDisabled: !validSelectedOptions.length to confirmButtonOptions.

2. Performance: sections and footerContent not memoized

RoomInvitePage.tsx:93 rebuilds sections inline every render. DynamicWorkspaceInvitePage.tsx:128 wraps it in useMemo. Same for footerContent (line 204 vs DynamicWorkspaceInvitePage line 215).

Minor observations (non-blocking)
  • shouldShowLoadingPlaceholderDynamicWorkspaceInvitePage checks !areOptionsInitialized || !didScreenTransitionEnd; RoomInvitePage only checks !areOptionsInitialized. Likely fine since shouldInitialize: didScreenTransitionEnd means areOptionsInitialized stays false until the transition ends, but worth confirming.

  • selectedNonExistingOptions search filtering in usePersonalDetailSearchSelector only checks text and login, while useSearchSelector also checks personalDetailSearchTerms. Acceptable for email-typed options but a minor inconsistency.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

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

@mkhutornyi
Copy link
Copy Markdown
Contributor

1. Bug: Missing isDisabled on confirmButtonOptions

RoomInvitePage.tsx:236-238 passes only onConfirm — no isDisabled. This means Ctrl+Enter fires inviteUsers even with zero selections (the function returns early but still cancels pending HTTP requests).

DynamicWorkspaceInvitePage.tsx:273-276 correctly passes isDisabled: !selectedOptions.length.

Fix: Add isDisabled: !validSelectedOptions.length to confirmButtonOptions.

@MelvinBot this is pre-existing bug on main branch right?
Let's fix this anyway

…gOptions

Test the selectedNonExistingOptions behavior including:
- Empty by default when no extra options exist
- Populated after toggling non-existing users
- Excludes existing contacts
- Cleared on deselection and resetSelection
- Filtered by debounced search term (login and text)
- Handles mix of existing and non-existing selected users

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Added 9 unit tests for usePersonalDetailSearchSelector's selectedNonExistingOptions in tests/unit/usePersonalDetailSearchSelectorTest.tsx:

  • Empty by default when no extra options exist
  • Populated after toggling non-existing users
  • Excludes existing contacts (only non-existing appear)
  • Cleared on deselection and resetSelection
  • Filtered by debounced search term (matches both login and text)
  • Handles mix of existing and non-existing selected users

All 9 tests pass.

Prevents Ctrl+Enter from firing inviteUsers with zero selections,
matching the pattern used in DynamicWorkspaceInvitePage.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Yes, this is a pre-existing bug on main. Fixed — added isDisabled: !validSelectedOptions.length to confirmButtonOptions, matching the DynamicWorkspaceInvitePage pattern.

@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot complete checklist, test steps and mark screenshots as done since they’ll be added in the reviewer checklist.

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Done — completed the PR author checklist, filled in test steps (Tests, Offline, QA), and marked screenshots as deferred to the reviewer checklist.

await waitForBatchedUpdatesWithAct();
expect(result.current.selectedNonExistingOptions).toHaveLength(2);

// Search for "newuser" - should filter to only the matching non-existing option
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.

@MelvinBot use another search term to fix spell check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed — replaced newuser with invitee in the test data and search term. Spellcheck should pass now.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot MelvinBot marked this pull request as ready for review May 22, 2026 07:10
@MelvinBot MelvinBot requested a review from a team as a code owner May 22, 2026 07:10
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Marked this PR as ready for review.

@melvin-bot melvin-bot Bot requested review from mkhutornyi and trjExpensify and removed request for a team and trjExpensify May 22, 2026 07:11
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 22, 2026

@mkhutornyi 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 May 22, 2026 07:11
@mkhutornyi
Copy link
Copy Markdown
Contributor

@MelvinBot fix failing typescript

@mkhutornyi
Copy link
Copy Markdown
Contributor

mkhutornyi commented May 22, 2026

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
    • MacOS: Desktop
  • 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 there are no new alerts related to the canBeMissing param for useOnyx
  • 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 shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • 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)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • 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)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • 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.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • 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
android.mov
Android: mWeb Chrome
iOS: HybridApp
ios.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
web.mov

Add optional chaining to .at(0) calls since Array.at() returns
T | undefined in TypeScript strict mode.

Co-authored-by: mkhutornyi <mkhutornyi@users.noreply.github.com>
@MelvinBot MelvinBot requested a review from a team as a code owner May 22, 2026 07:19
@MelvinBot
Copy link
Copy Markdown
Contributor Author

Fixed the failing typecheck: added optional chaining (?.) to .at(0) calls in usePersonalDetailSearchSelectorTest.tsxArray.at() returns T | undefined in strict mode.

@melvin-bot melvin-bot Bot requested review from francoisl and removed request for a team May 22, 2026 07:19
@melvin-bot
Copy link
Copy Markdown

melvin-bot Bot commented May 22, 2026

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

@MelvinBot
Copy link
Copy Markdown
Contributor Author

Regression Analysis

No regressions found. The PR changes are safe and follow established patterns.

Investigation details (4 areas checked)

1. Section index gaps — Safe

The new code hardcodes sectionIndex to 0, 1, 2 even when some sections are empty (creating gaps). This is safe — sectionIndex is only used to build string keys for FlashList reconciliation (useFlattenedSections.ts:61,74). Multiple existing callers (e.g. CategoryOptionListUtils.ts) already use non-contiguous indexes in production.

2. Footer styling (mb5/ph5 removed) — Safe

3. Old if/else section logic replaced with independent ifs — Safe

The old code showed userToInvite exclusively (hiding personalDetails), but this was never hiding anything — userToInvite is only non-null when personalDetails is empty. canCreateOptimisticPersonalDetailOption returns false when any results exist. The new independent-if logic produces identical output.

4. No duplicate button (confirmButtonOptions + footerContent) — Safe

Footer.tsx:16-24 renders footerContent and returns early, never reaching the confirm button branch. confirmButtonOptions.onConfirm only powers the Ctrl+Enter keyboard shortcut. This matches DynamicWorkspaceInvitePage exactly.

const MOCK_ACCOUNT_ID = 12345;
const MOCK_EMAIL = 'test@expensify.com';

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
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.

❌ CONSISTENCY-5 (docs)

This eslint-disable-next-line suppresses @typescript-eslint/no-unsafe-return without an accompanying comment explaining why the rule is disabled. Every eslint-disable should include a justification so reviewers and future maintainers understand the reasoning.

Add a justification comment, for example:

// eslint-disable-next-line @typescript-eslint/no-unsafe-return -- jest.requireActual returns untyped module
jest.mock('@libs/PersonalDetailOptionsListUtils', () => ({

Reviewed at: fab4748 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

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.

Fair but not going to block on this for test

const MOCK_ACCOUNT_ID = 12345;
const MOCK_EMAIL = 'test@expensify.com';

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
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.

Fair but not going to block on this for test

@francoisl francoisl merged commit 794b05a into main May 22, 2026
40 checks passed
@francoisl francoisl deleted the claude-stopScrollJumpRoomInvite branch May 22, 2026 18:46
@github-actions
Copy link
Copy Markdown
Contributor

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

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

@OSBotify
Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/francoisl in version: 9.3.80-0 🚀

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

Bundle Size Analysis (Sentry):

@MelvinBot
Copy link
Copy Markdown
Contributor Author

No help site changes are required for this PR.

This PR fixes a UI behavior bug (scroll jumping when selecting contacts on the Room Invite page). The existing documentation in Chat-Features-and-Moderation-Tools.md accurately describes the invite flow — no steps, labels, or features were changed.

@OSBotify
Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/luacmartins in version: 9.3.81-2 🚀

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

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.

4 participants