fix: Streams slowing down page loads or not loading at all (#620)
This commit is contained in:
parent
e9b1f17235
commit
b6f0bd356a
12 changed files with 62 additions and 47 deletions
|
@ -1,8 +1,8 @@
|
|||
<script setup lang="ts">
|
||||
import type { Status } from 'masto'
|
||||
const paginator = useMasto().timelines.iterateHome()
|
||||
const stream = await useMasto().stream.streamUser()
|
||||
onBeforeUnmount(() => stream.disconnect())
|
||||
const stream = useMasto().stream.streamUser()
|
||||
onBeforeUnmount(() => stream?.then(s => s.disconnect()))
|
||||
|
||||
const maxDistance = 10
|
||||
function preprocess(items: Status[]) {
|
||||
|
|
|
@ -5,7 +5,7 @@ const paginator = useMasto().notifications.iterate({ limit: 30, types: ['mention
|
|||
const { clearNotifications } = useNotifications()
|
||||
onActivated(clearNotifications)
|
||||
|
||||
const stream = await useMasto().stream.streamUser()
|
||||
const stream = useMasto().stream.streamUser()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -5,7 +5,7 @@ const paginator = useMasto().notifications.iterate({ limit: 30 })
|
|||
const { clearNotifications } = useNotifications()
|
||||
onActivated(clearNotifications)
|
||||
|
||||
const stream = await useMasto().stream.streamUser()
|
||||
const stream = useMasto().stream.streamUser()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
@ -6,7 +6,7 @@ import type { FilterContext, Paginator, Status, WsEvents } from 'masto'
|
|||
|
||||
const { paginator, stream } = defineProps<{
|
||||
paginator: Paginator<any, Status[]>
|
||||
stream?: WsEvents
|
||||
stream?: Promise<WsEvents>
|
||||
context?: FilterContext
|
||||
preprocess?: (items: any[]) => any[]
|
||||
}>()
|
||||
|
|
11
components/timeline/TimelinePublic.vue
Normal file
11
components/timeline/TimelinePublic.vue
Normal file
|
@ -0,0 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
const paginator = useMasto().timelines.iteratePublic()
|
||||
const stream = useMasto().stream.streamPublicTimeline()
|
||||
onBeforeUnmount(() => stream.then(s => s.disconnect()))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<TimelinePaginator v-bind="{ paginator, stream }" context="public" />
|
||||
</div>
|
||||
</template>
|
11
components/timeline/TimelinePublicLocal.vue
Normal file
11
components/timeline/TimelinePublicLocal.vue
Normal file
|
@ -0,0 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
const paginator = useMasto().timelines.iteratePublic({ local: true })
|
||||
const stream = useMasto().stream.streamCommunityTimeline()
|
||||
onBeforeUnmount(() => stream.then(s => s.disconnect()))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<TimelinePaginator v-bind="{ paginator, stream }" context="public" />
|
||||
</div>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue