Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ function ReportActionsList({
const isReportArchived = useReportIsArchived(report?.reportID);

const [isScrollToBottomEnabled, setIsScrollToBottomEnabled] = useState(false);
const [shouldScrollToEndAfterLayout, setShouldScrollToEndAfterLayout] = useState(false);
const [actionIdToHighlight, setActionIdToHighlight] = useState('');

useEffect(() => {
Expand Down Expand Up @@ -388,9 +389,19 @@ function ReportActionsList({
if (linkedReportActionID) {
return;
}

const shouldScrollToEnd = (isExpenseReport(report) || isTransactionThread(parentReportAction)) && isSearchTopmostFullScreenRoute();

if (shouldScrollToEnd) {
setShouldScrollToEndAfterLayout(true);
}

InteractionManager.runAfterInteractions(() => {
setIsFloatingMessageCounterVisible(false);
reportScrollManager.scrollToBottom();

if (!shouldScrollToEnd) {

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.

Not including setIsFloatingMessageCounterVisible within the new condition shouldScrollToEnd made the New Message floating message to disappear. This was addressed in #71962

reportScrollManager.scrollToBottom();
}
});
// eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
}, []);
Expand Down Expand Up @@ -678,8 +689,12 @@ function ReportActionsList({
reportScrollManager.scrollToBottom();
setIsScrollToBottomEnabled(false);
}
if (shouldScrollToEndAfterLayout) {
reportScrollManager.scrollToEnd();
setShouldScrollToEndAfterLayout(false);
}
},
[isScrollToBottomEnabled, onLayout, reportScrollManager],
[isScrollToBottomEnabled, onLayout, reportScrollManager, shouldScrollToEndAfterLayout],
);

const retryLoadNewerChatsError = useCallback(() => {
Expand Down