Fix article get read when navigation to admin area.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { onMounted, computed, nextTick, watch } from 'vue';
|
||||
import { onMounted, onBeforeUnmount, computed, nextTick, watch } from 'vue';
|
||||
import { useFeeds } from '@/composables/useFeeds';
|
||||
|
||||
const {
|
||||
@@ -14,6 +14,7 @@ const {
|
||||
fetchData,
|
||||
sync,
|
||||
getReadable,
|
||||
disconnectObserver,
|
||||
setInitialLoad,
|
||||
showMessageForXSeconds,
|
||||
} = useFeeds()
|
||||
@@ -74,6 +75,11 @@ async function shareUrl(url) {
|
||||
}
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
disconnectObserver()
|
||||
setInitialLoad(false)
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
setInitialLoad(false)
|
||||
await fetchData()
|
||||
|
||||
@@ -268,6 +268,13 @@ function handleIntersection(entries, topbarHeight = 0) {
|
||||
})
|
||||
}
|
||||
|
||||
function disconnectObserver() {
|
||||
if (observer) {
|
||||
observer.disconnect()
|
||||
observer = null
|
||||
}
|
||||
}
|
||||
|
||||
function setInitialLoad(value) {
|
||||
initialLoad = value
|
||||
}
|
||||
@@ -375,6 +382,7 @@ export function useFeeds() {
|
||||
markAllRead,
|
||||
showMessageForXSeconds,
|
||||
setupIntersectionObserver,
|
||||
disconnectObserver,
|
||||
setInitialLoad,
|
||||
handleIntersection,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user