File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 33 <free-tokens-dialog v-model =" isShowFreeTokensDialog" />
44 <a-chat
55 ref =" chatRef"
6+ :key =" dateRefreshKey"
67 :messages =" messages"
78 :show-new-chat-placeholder =" showNewChatPlaceholder"
89 :partners =" partners"
@@ -333,6 +334,9 @@ const showSpinner = useChatsSpinner()
333334
334335const isMenuOpen = ref (false )
335336
337+ // Key for forcing date refresh when app becomes visible after being in background
338+ const dateRefreshKey = ref (0 )
339+
336340const attachments = useAttachments (props .partnerId )()
337341const handleAttachments = (files : FileData []) => {
338342 const maxFileSizeExceeded = files .some (({ file }) => file .size >= UPLOAD_MAX_FILE_SIZE )
@@ -521,7 +525,16 @@ onMounted(async () => {
521525 isScrolledToBottom .value = chatRef .value .isScrolledToBottom ()
522526 })
523527 visibilityId .value = Visibility .change ((event , state ) => {
524- if (state === ' visible' && isScrolledToBottom .value ) markAsRead ()
528+ if (state === ' visible' ) {
529+ // Force refresh dates when returning to visible state
530+ dateRefreshKey .value = Date .now ()
531+
532+ nextTick (() => {
533+ chatRef .value ?.maintainScrollPosition ()
534+ })
535+
536+ if (isScrolledToBottom .value ) markAsRead ()
537+ }
525538 })
526539
527540 const draftMessage = store .getters [' draftMessage/draftReplyTold' ](props .partnerId )
You can’t perform that action at this time.
0 commit comments