Skip to content

Commit

Permalink
feat: reset list for isFetchingFirstPage only
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jul 18, 2024
1 parent 2ff9bbc commit ed1ff0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/renderer/src/modules/entry-column/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@ export const useEntriesByView = ({
// so we memo this previous data to avoid the flicker
const prevEntryIdsRef = useRef(entryIds)

const isFetchingFirstPage = query.isFetching && !query.isFetchingNextPage

useEffect(() => {
if (!query.isFetching) {
if (!isFetchingFirstPage) {
prevEntryIdsRef.current = entryIds
setMergedEntries(entryIds)
onReset?.()
}
}, [query.isFetching])
}, [isFetchingFirstPage])

const [mergedEntries, setMergedEntries] = useState<string[]>([])

Expand Down

0 comments on commit ed1ff0c

Please sign in to comment.