Skip to content

useAsyncData with comma breaks #15272

@Tragio

Description

@Tragio

Environment

  • Operating System: Darwin
  • Node Version: v14.19.1
  • Nuxt Version: 3.0.0-rc.12
  • Nitro Version: 0.6.0
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: telemetry, ssr, app, modules, formkit, purgeCSS, pwa, css, vite
  • Runtime Modules: @pinia/nuxt@0.4.3, @kevinmarrec/nuxt-pwa@0.9.1, nuxt-font-metrics@0.2.1, nuxt-purgecss@2.0.0, @nuxtjs/html-validator@1.1.0, @vueuse/nuxt@9.3.1, @formkit/nuxt@1.0.0-beta.11
  • Build Modules: -

Reproduction

Not working:

const data = await useAsyncData(() =>
  $fetch('https://api.nuxtjs.dev/mountains'),
)

Working:

const data = await useAsyncData(() =>
  $fetch('https://api.nuxtjs.dev/mountains')
)

Describe the bug

If I have a , at the end of the $fetch it does not work, if I remove, it works.

If I have the , I have this on the console Uncaught SyntaxError: Unexpected token ',' (at edit.vue?macro=true:14:1)

CleanShot_2022-10-26_at_14 02 30

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions