From c664f5ba0b205a45fde2ca1a36c386ed0bf0ee41 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Thu, 7 Nov 2024 16:56:04 +0300 Subject: [PATCH] set lastVisibleActionCreated Optimistically --- src/libs/actions/Report.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 9ea499283d70..e6a10d01b798 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -3676,6 +3676,9 @@ function completeOnboarding( }, []); const optimisticData: OnyxUpdate[] = [...tasksForOptimisticData]; + const lastVisibleActionCreated = + tasksData.at(-1)?.completedTaskReportAction?.created ?? tasksData.at(-1)?.taskReportAction.reportAction.created ?? videoCommentAction?.created ?? textCommentAction.created; + optimisticData.push( { onyxMethod: Onyx.METHOD.MERGE, @@ -3683,6 +3686,7 @@ function completeOnboarding( value: { lastMentionedTime: DateUtils.getDBTime(), hasOutstandingChildTask, + lastVisibleActionCreated, }, }, { @@ -3724,12 +3728,12 @@ function completeOnboarding( const {lastMessageText = '', lastMessageTranslationKey = ''} = ReportActionsUtils.getLastVisibleMessage(targetChatReportID); if (lastMessageText || lastMessageTranslationKey) { const lastVisibleAction = ReportActionsUtils.getLastVisibleAction(targetChatReportID); - const lastVisibleActionCreated = lastVisibleAction?.created; + const prevLastVisibleActionCreated = lastVisibleAction?.created; const lastActorAccountID = lastVisibleAction?.actorAccountID; failureReport = { lastMessageTranslationKey, lastMessageText, - lastVisibleActionCreated, + lastVisibleActionCreated: prevLastVisibleActionCreated, lastActorAccountID, }; }