Skip to content

Pre-render using useAsyncData #1

@qin-guan

Description

@qin-guan

const videos = ref([]);
async function getVideos() {
const { data } = await useSupabase()
.from("episodes")
.select()
.order("published_at", { ascending: false })
.limit(10);
videos.value = data;
}
onMounted(() => {
getVideos();
});

This could probably be

const { data: videos } = await useAsyncData(`videos`, () => useSupabase()
    .from("episodes")
    .select()
    .order("published_at", { ascending: false })
    .limit(10)
)

So that the data is pre-rendered

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions