From c34e97924328468fe0eef7270a37bed01814ab1e Mon Sep 17 00:00:00 2001 From: Chirag Chandrakant Salian Date: Fri, 24 May 2024 15:55:20 -0700 Subject: [PATCH] Revert "Fix linked message visibility in offline mode" --- src/libs/actions/Report.ts | 8 -------- src/pages/home/report/ReportActionsView.tsx | 14 +++----------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index c9ff3c485198..26aaa7661de7 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3579,13 +3579,6 @@ function updateLastVisitTime(reportID: string) { Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {lastVisitTime: DateUtils.getDBTime()}); } -function updateLoadingInitialReportAction(reportID: string) { - if (!ReportUtils.isValidReportIDFromPath(reportID)) { - return; - } - Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, {isLoadingInitialReportActions: false}); -} - function clearNewRoomFormError() { Onyx.set(ONYXKEYS.FORMS.NEW_ROOM_FORM, { isLoading: false, @@ -3826,7 +3819,6 @@ export { leaveGroupChat, removeFromGroupChat, updateGroupChatMemberRoles, - updateLoadingInitialReportAction, clearAddRoomMemberError, clearAvatarErrors, }; diff --git a/src/pages/home/report/ReportActionsView.tsx b/src/pages/home/report/ReportActionsView.tsx index 045a796a329c..cd54a8b88511 100755 --- a/src/pages/home/report/ReportActionsView.tsx +++ b/src/pages/home/report/ReportActionsView.tsx @@ -104,7 +104,6 @@ function ReportActionsView({ const didLayout = useRef(false); const didLoadOlderChats = useRef(false); const didLoadNewerChats = useRef(false); - const {isOffline} = useNetwork(); // triggerListID is used when navigating to a chat with messages loaded from LHN. Typically, these include thread actions, task actions, etc. Since these messages aren't the latest,we don't maintain their position and instead trigger a recalculation of their positioning in the list. // we don't set currentReportActionID on initial render as linkedID as it should trigger visibleReportActions after linked message was positioned @@ -129,14 +128,6 @@ function ReportActionsView({ Report.openReport(reportID, reportActionID); }; - useEffect(() => { - // When we linked to message - we do not need to wait for initial actions - they already exists - if (!reportActionID || !isOffline) { - return; - } - Report.updateLoadingInitialReportAction(report.reportID); - }, [isOffline, report.reportID, reportActionID]); - useLayoutEffect(() => { setCurrentReportActionID(''); }, [route]); @@ -208,7 +199,7 @@ function ReportActionsView({ */ const fetchNewerAction = useCallback( (newestReportAction: OnyxTypes.ReportAction) => { - if (isLoadingNewerReportActions || isLoadingInitialReportActions || (reportActionID && isOffline)) { + if (isLoadingNewerReportActions || isLoadingInitialReportActions) { return; } @@ -225,7 +216,7 @@ function ReportActionsView({ Report.getNewerActions(reportID, newestReportAction.reportActionID); } }, - [isLoadingNewerReportActions, isLoadingInitialReportActions, reportActionID, isOffline, transactionThreadReport, reportActionIDMap, reportID], + [isLoadingNewerReportActions, isLoadingInitialReportActions, reportID, transactionThreadReport, reportActionIDMap], ); const hasMoreCached = reportActions.length < combinedReportActions.length; @@ -357,6 +348,7 @@ function ReportActionsView({ // If there was an error only try again once on initial mount. We should also still load // more in case we have cached messages. (!hasMoreCached && didLoadNewerChats.current && hasLoadingNewerReportActionsError) || + network.isOffline || newestReportAction.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE) ) { return;