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, }; }