nuxt-modules / nuxt-modules/strapi
Problem with useAsyncData when use NuxtLInk
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 717
- Forks
- 89
- Avg merge
- 7h 3m
- Merged PRs (30d)
- 6
Description
Hi, I don't know If the problem is with nuxt or nuxt/strapi plugin.
If I use <NuxtLink> like this:
<v-btn
color="secondary"
link
:to="localePath({ name: 'sanitarne-kabinky-slug', params: { slug: product.attributes.slug } })"
class="px-10"
>
Pozrieť produkt
</v-btn>
I get error
It will happened when I load data like this:
const { data: products, refresh: refreshProducts } = await useAsyncData("sanitary-cabins", () =>
find<any>("sanitary-cabins", { populate: "*" })
);
but If load data like this:
const products = await find<any>("sanitary-cabins", { populate: "*" });
it works. This is how I display data in template:
<v-col cols="12" md="4" v-for="(product, index) in products?.data" :key="index">
<article>
<v-img
:src="
product.attributes.gallery.data != null
? store.getMediaUrl(product.attributes.gallery.data[0].attributes.formats.medium.url)
: ''
"
width="100%"
height="230px"
cover
class="mb-4"
></v-img>
<h3 class="mb-4">{{ product.attributes.title }}</h3>
<v-btn
color="secondary"
link
:to="localePath({ name: 'sanitarne-kabinky-slug', params: { slug: product.attributes.slug } })"
class="px-10"
>
Pozrieť produkt
</v-btn>
</article>
</v-col>
Can anybody help?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported error with the NuxtLink example and the useAsyncData call in the issue, then compare it with the direct find call that works. Check whether the problem belongs to Nuxt or the Strapi module; done means identifying the cause and documenting or fixing the affected integration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100