Tabletop
Tabletop
Explore posts from servers
NNuxt
Created by Tabletop on 12/9/2024 in #❓・help
New to Nuxt: should I do all data fetching in Pinia?
"SSR considerations: Nuxt provides built-in composables like useFetch and useAsyncData that are optimized for server-side rendering and handle caching automatically"
7 replies
NNuxt
Created by Tabletop on 12/9/2024 in #❓・help
New to Nuxt: should I do all data fetching in Pinia?
@l422y can you think of any good code snippets or tutorials that show a good use of pinia that is safe for SSR? So I should really push all significant data fetching into Pinia?
7 replies
KPCKevin Powell - Community
Created by Tabletop on 12/6/2024 in #front-end
Vue, Pinia, VueRouter and await
just thinking, a strategy to make sure getFiles is only run once
8 replies
KPCKevin Powell - Community
Created by Tabletop on 12/6/2024 in #front-end
Vue, Pinia, VueRouter and await
//data.ts
export const useDataStore = defineStore('data', () => {
let files = ref<Record<string,any>[]>([])

async function getFiles(){
files.value = await client.request(...)

return {
files
}

//index.vue
const data = useDataStore()
(async () => await data.getFiles())();
(async () => await data.getTags())();
//data.ts
export const useDataStore = defineStore('data', () => {
let files = ref<Record<string,any>[]>([])

async function getFiles(){
files.value = await client.request(...)

return {
files
}

//index.vue
const data = useDataStore()
(async () => await data.getFiles())();
(async () => await data.getTags())();
8 replies
KPCKevin Powell - Community
Created by Tabletop on 12/6/2024 in #front-end
Vue, Pinia, VueRouter and await
I've copied your code just wondering why you don't use the Composition API
8 replies