Skip to content

Commit

Permalink
feat: throttle pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jan 26, 2024
1 parent fb3b093 commit 47660d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/pages/posts/navigation/PostsPagination.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script setup>
import { vIntersectionObserver } from '@vueuse/components'
import { useThrottleFn } from '@vueuse/core'
const emit = defineEmits(['loadNextPage'])
Expand All @@ -10,11 +11,13 @@
emit('loadNextPage')
}
const throttledOnIntersectionObserver = useThrottleFn(onIntersectionObserver, 350)
</script>

<template>
<div
v-intersection-observer="[onIntersectionObserver, { rootMargin: '0px 0px 0px 0px', threshold: [1] }]"
v-intersection-observer="[throttledOnIntersectionObserver, { rootMargin: '0px 0px 0px 0px', threshold: [1] }]"
class="flex items-center justify-center rounded-md px-4 py-2 text-sm font-medium text-base-content"
data-testid="load-next-page"
>
Expand Down

0 comments on commit 47660d0

Please sign in to comment.