Skip to content

Fix: Welcome header showing after contents in workspace chat - #85788

Closed
victorjzq wants to merge 1 commit into
Expensify:mainfrom
victorjzq:fix/issue-85487
Closed

victorjzq wants to merge 1 commit into
Expensify:mainfrom
victorjzq:fix/issue-85487

Conversation

@victorjzq

@victorjzq victorjzq commented Mar 19, 2026 •

Copy link
Copy Markdown

/claim #85487

When a user creates a manual expense from a workspace chat, the welcome header was appearing below the expense report preview instead of at the top. Workspace chats don't go through the shouldFocusToTopOnMount scroll path, so the bug lives in scrollToBottomForCurrentUserAction.

The sortedVisibleReportActionsRef is updated via a useEffect that runs asynchronously after render. When InteractionManager.runAfterInteractions fires, the ref may still hold the old array (just the CREATED action), making findIndex return -1 for the newly added REPORT_PREVIEW. The else branch then calls scrollToBottom() immediately against stale layout data, and the subsequent setIsScrollToBottomEnabled(true) triggers a second scroll on the next layout event — creating a race that leaves the CREATED welcome header below the content.

The fix splits the index === -1 case out of the else branch and defers the scroll to requestAnimationFrame, giving the FlatList one frame to incorporate the new item into its layout before scrolling. Since we scroll in the rAF callback, setIsScrollToBottomEnabled is not needed for this path and we return early to skip it.

$ #85487

@melvin-bot
melvin-bot Bot requested review from heyjennahay and removed request for a team March 19, 2026 12:23
@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi @victorjzq, thanks for your interest in contributing to Expensify!

This PR has been automatically closed because it doesn't appear to meet our contribution requirements:

  • You are not a member of the Expensify GitHub organization
  • No linked GitHub issue was found in the PR description where you are listed as an assignee
  • No linked GitHub PR was found in the PR description where you are the author or a reviewer

If you'd like to contribute, please make sure to:

  1. Find an open issue you'd like to work on
  2. Get assigned to the issue by following our contribution process
  3. Link the issue in your PR description using the format: $ https://github.com/Expensify/App/issues/<issueID>

Please review our contributing guidelines for more details.

If you believe this was closed in error, please reach out in the #expensify-open-source Slack channel.

@github-actions github-actions Bot closed this Mar 19, 2026
@github-actions github-actions Bot locked as spam and limited conversation to collaborators Mar 19, 2026
@melvin-bot
melvin-bot Bot requested review from lakchote and removed request for a team March 19, 2026 12:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant