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 @@
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 @@
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 @@ -447,7 +458,7 @@
setIsScrollToBottomEnabled(true);
});
},
[report.reportID, reportScrollManager, setIsFloatingMessageCounterVisible, sortedVisibleReportActions, reportScrollManager],

Check warning on line 461 in src/pages/home/report/ReportActionsList.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has a duplicate dependency: 'reportScrollManager'. Either omit it or remove the dependency array
);

// Clear the highlighted report action after scrolling and highlighting
Expand Down Expand Up @@ -678,8 +689,12 @@
reportScrollManager.scrollToBottom();
setIsScrollToBottomEnabled(false);
}
if (shouldScrollToEndAfterLayout) {
reportScrollManager.scrollToEnd();
setShouldScrollToEndAfterLayout(false);
}
},
[isScrollToBottomEnabled, onLayout, reportScrollManager],
[isScrollToBottomEnabled, onLayout, reportScrollManager, shouldScrollToEndAfterLayout],
);

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