File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -340,8 +340,8 @@ const showSpinner = useChatsSpinner()
340340
341341const isMenuOpen = ref (false )
342342
343- // Key for forcing date refresh when app becomes visible after being in background
344343const dateRefreshKey = ref (0 )
344+ const lastVisibleDate = ref (new Date ().toDateString ())
345345
346346const attachments = useAttachments (props .partnerId )()
347347const handleAttachments = (files : FileData []) => {
@@ -566,8 +566,12 @@ onMounted(async () => {
566566 })
567567 visibilityId .value = Visibility .change ((event , state ) => {
568568 if (state === ' visible' ) {
569- // Force refresh dates when returning to visible state
570- dateRefreshKey .value = Date .now ()
569+ const currentDate = new Date ().toDateString ()
570+
571+ if (currentDate !== lastVisibleDate .value ) {
572+ dateRefreshKey .value = Date .now ()
573+ lastVisibleDate .value = currentDate
574+ }
571575
572576 nextTick (() => {
573577 chatRef .value ?.maintainScrollPosition ()
You can’t perform that action at this time.
0 commit comments