mirror of
				https://github.com/tooot-app/app
				synced 2025-06-05 22:19:13 +02:00 
			
		
		
		
	Refetch only latest pages
This commit is contained in:
		@@ -223,6 +223,18 @@ const TimelineRefresh: React.FC<Props> = ({
 | 
			
		||||
    if (readMarker) {
 | 
			
		||||
      setAccountStorage([{ key: readMarker, value: undefined }])
 | 
			
		||||
    }
 | 
			
		||||
    queryClient.setQueryData<
 | 
			
		||||
      InfiniteData<
 | 
			
		||||
        PagedResponse<(Mastodon.Status | Mastodon.Notification | Mastodon.Conversation)[]>
 | 
			
		||||
      >
 | 
			
		||||
    >(queryKey, old => {
 | 
			
		||||
      if (!old) return old
 | 
			
		||||
 | 
			
		||||
      return {
 | 
			
		||||
        pages: [old.pages[0]],
 | 
			
		||||
        pageParams: [old.pageParams[0]]
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
    await refetch()
 | 
			
		||||
    setTimeout(() => flRef.current?.scrollToOffset({ offset: 0 }), 50)
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
@@ -131,9 +131,9 @@ const Timeline: React.FC<Props> = ({
 | 
			
		||||
 | 
			
		||||
              const firstItemId = viewableItems.filter(item => item.isViewable)[0]?.item.id
 | 
			
		||||
              if (!fetchingActive.current && firstItemId && firstItemId > (marker || '0')) {
 | 
			
		||||
                // setAccountStorage([{ key: readMarker, value: firstItemId }])
 | 
			
		||||
                setAccountStorage([{ key: readMarker, value: firstItemId }])
 | 
			
		||||
              } else {
 | 
			
		||||
                setAccountStorage([{ key: readMarker, value: '109519141378761752' }])
 | 
			
		||||
                // setAccountStorage([{ key: readMarker, value: '109519141378761752' }])
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
          }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user