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
10 changes: 5 additions & 5 deletions src/pages/home/report/ReportActionsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function ReportActionsView({

const {shouldUseNarrowLayout} = useResponsiveLayout();
const isFocused = useIsFocused();
const [isNavigatingToLinkedMessage, setNavigatingToLinkedMessage] = useState(!!reportActionID);
const [isNavigatingToLinkedMessage, setNavigatingToLinkedMessage] = useState(false);
const prevShouldUseNarrowLayoutRef = useRef(shouldUseNarrowLayout);
const reportID = report.reportID;
const isReportFullyVisible = useMemo((): boolean => getIsReportFullyVisible(isFocused), [isFocused]);
Expand Down Expand Up @@ -279,16 +279,16 @@ function ReportActionsView({
useEffect(() => {
let timerID: NodeJS.Timeout;

if (isTheFirstReportActionIsLinked) {
if (!isTheFirstReportActionIsLinked && reportActionID) {
setNavigatingToLinkedMessage(true);
} else {
// After navigating to the linked reportAction, apply this to correctly set
// `autoscrollToTopThreshold` prop when linking to a specific reportAction.
// eslint-disable-next-line @typescript-eslint/no-deprecated
InteractionManager.runAfterInteractions(() => {
// Using a short delay to ensure the view is updated after interactions
timerID = setTimeout(() => setNavigatingToLinkedMessage(false), 10);
});
} else {
setNavigatingToLinkedMessage(false);
}

return () => {
Expand All @@ -297,7 +297,7 @@ function ReportActionsView({
}
clearTimeout(timerID);
};
}, [isTheFirstReportActionIsLinked]);
}, [isTheFirstReportActionIsLinked, reportActionID]);

// Show skeleton while loading initial report actions when data is incomplete/missing and online
const shouldShowSkeletonForInitialLoad = isLoadingInitialReportActions && (isReportDataIncomplete || isMissingReportActions) && !isOffline;
Expand Down
Loading