fix(dashboard): bind Upcoming sidebar to reactive useFetch data
ColumnsLayout mounts inside <ClientOnly> on /member/dashboard, so the SSR fetch returned the empty default and the snapshot assignment to upcomingEvents never re-ran after the client-side fetch resolved. Skip the SSR phase explicitly (server: false) and expose data to the template via a computed so post-fetch updates propagate to EventsMiniSidebar.
This commit is contained in:
parent
94b242100c
commit
050d117abf
1 changed files with 3 additions and 2 deletions
|
|
@ -29,13 +29,14 @@ const props = defineProps({
|
||||||
limit: { type: Number, default: 3 },
|
limit: { type: Number, default: 3 },
|
||||||
})
|
})
|
||||||
|
|
||||||
const upcomingEvents = ref([])
|
let upcomingEvents = ref([])
|
||||||
if (props.cols === 'events-sidebar') {
|
if (props.cols === 'events-sidebar') {
|
||||||
const { data } = await useFetch('/api/events', {
|
const { data } = await useFetch('/api/events', {
|
||||||
query: { upcoming: true, limit: props.limit },
|
query: { upcoming: true, limit: props.limit },
|
||||||
default: () => [],
|
default: () => [],
|
||||||
|
server: false,
|
||||||
})
|
})
|
||||||
upcomingEvents.value = data.value || []
|
upcomingEvents = computed(() => data.value || [])
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue