refactor: no reactivity transform (#2600)

This commit is contained in:
patak 2024-02-21 16:20:08 +01:00 committed by GitHub
parent b9394c2fa5
commit ccfa7a8d10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
102 changed files with 649 additions and 652 deletions

View file

@ -19,8 +19,8 @@ export function usePaginator<T, P, U = T>(
const prevItems = ref<T[]>([])
const endAnchor = ref<HTMLDivElement>()
const bound = reactive(useElementBounding(endAnchor))
const isInScreen = $computed(() => bound.top < window.innerHeight * 2)
const bound = useElementBounding(endAnchor)
const isInScreen = computed(() => bound.top.value < window.innerHeight * 2)
const error = ref<unknown | undefined>()
const deactivated = useDeactivated()
@ -29,11 +29,11 @@ export function usePaginator<T, P, U = T>(
prevItems.value = []
}
watch(stream, async (stream) => {
if (!stream)
watch(() => stream, async (stream) => {
if (!stream.value)
return
for await (const entry of stream) {
for await (const entry of stream.value) {
if (entry.event === 'update') {
const status = entry.payload
@ -115,11 +115,10 @@ export function usePaginator<T, P, U = T>(
})
}
watch(
() => [isInScreen, state],
watchEffect(
() => {
if (
isInScreen
isInScreen.value
&& state.value === 'idle'
// No new content is loaded when the keepAlive page enters the background
&& deactivated.value === false