BeerDuck
BeerDuck
NNuxt
Created by Tajeddine on 5/1/2024 in #❓・help
Hydration class mismatch
Easiest way to figure out where it is comming from is opening the page. once with javascript enabled and once with javascript disabled. Now you can see which object causes the mismatch.
4 replies
NNuxt
Created by JV on 4/23/2024 in #❓・help
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
watch(() => watachablevalue, (newVal,oldVal) => { //use variable or do something when variable changes. }); This keeps track on variable changes if i am correct.
32 replies
NNuxt
Created by JV on 4/23/2024 in #❓・help
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
btw above code isnt optimal or directly logical to use in any situation in my mind, but i think this solves your issue. And looks mostly like your old code
32 replies
NNuxt
Created by JV on 4/23/2024 in #❓・help
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
const homePageLoaded = ref(false); const homePage = ref(1); async function loaddata(){ const{ data: thedata } = useAsyncData( async () => { return await loadHomePage(); }); homePage.value=thedata; homePageLoaded.value = true; } await loaddata();
32 replies
NNuxt
Created by JV on 4/23/2024 in #❓・help
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
I try to explain what happens, and maybe it is not 100% correct but. Your code within your asyncdata will not be executed a second time. because the whole function gets skipped, and the data: homepage gets filled in without executing the function again. This is why everything that happens within the function does not get executed a second time. What i think you just want is an normal function around it.
32 replies
NNuxt
Created by JV on 4/23/2024 in #❓・help
moving from Nuxt2 useFetch to Nuxt3 useAsyncData - how would you refactor this example?
@JV Do you mean your homePageLoaded.value is at the end still false?
32 replies