Unverified Commit 267d7bf6 authored by Daniel Roe's avatar Daniel Roe Committed by GitHub

perf: fetch comments & item in parallel (#104)

parent 7a37f90c
...@@ -4,8 +4,7 @@ import { host, timeAgo, isAbsolute } from '~/composables/utils' ...@@ -4,8 +4,7 @@ import { host, timeAgo, isAbsolute } from '~/composables/utils'
const route = useRoute() const route = useRoute()
const id = $computed(() => route.params.id as string) const id = $computed(() => route.params.id as string)
const resultItem = await fetchItem(id) const [resultItem, resultComments] = await Promise.all([fetchItem(id), fetchComments(id)])
const resultComments = await fetchComments(id)
const { data: item } = $(resultItem) const { data: item } = $(resultItem)
const { data: comments, loading: commentsLoading } = $(resultComments) const { data: comments, loading: commentsLoading } = $(resultComments)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment