Skip to content

Commit 148cc2e

Browse files
committed
fix: run DOM-dependent watchers after render
Vue runs normal watcher callbacks before the owner component DOM has updated. These watchers read or mutate DOM state after reactive values change, so flush="post" schedules them after Vue applies the render update. Docs: https://vuejs.org/guide/essentials/watchers.html#callback-flush-timing
1 parent 66a8d84 commit 148cc2e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

app/components/AdminDashboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ watch(currentPage, () => {
320320
if (feedbackContainer.value) {
321321
feedbackContainer.value.scrollTop = 0
322322
}
323-
})
323+
}, { flush: 'post' })
324324
</script>
325325

326326
<template>

app/pages/modules/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ watch(scrollY, (y) => {
9191
if (window.innerHeight + y >= document.documentElement.scrollHeight - SCROLL_THRESHOLD) {
9292
debouncedLoadMore()
9393
}
94-
})
94+
}, { flush: 'post' })
9595
9696
watch(filteredModules, () => {
9797
isLoading.value = false

0 commit comments

Comments
 (0)