nuxt-modules / nuxt-modules/strapi

Problem with useAsyncData when use NuxtLInk

Open
#393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
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
image

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.