Multiple calls to useAsyncQuery
from composable function causes 500 error in SSR
#614
Labels
useAsyncQuery
from composable function causes 500 error in SSR
#614
Environment
Describe the bug
Calling
useAsyncQuery
more than once inside a composable function results in a 500 error when loading a SSR route, with the following error message:Expected behaviour
Should be able to execute more than a single query in a composable function.
Reproduction
https://stackblitz.com/edit/github-tfy4rs?file=composables%2FuseMultipleQuery.ts
Example composable function:
Additional context
Executing multiple queries with
useAsyncQuery
works as expected when inside<script setup>
or loading a route in client-side context.Logs
500 [nuxt] A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function. This is probably not a Nuxt bug. Find out more at `https://nuxt.com/docs/guide/concepts/auto-imports#vue-and-nuxt-composables`. at useApollo (./node_modules/@nuxtjs/apollo/dist/runtime/composables.mjs:75:41) at prep (./node_modules/@nuxtjs/apollo/dist/runtime/composables.mjs:26:23) at Module.useAsyncQuery (./node_modules/@nuxtjs/apollo/dist/runtime/composables.mjs:16:32) at Module.useMultipleQuery (./composables/useMultipleQuery.ts:19:51) at async setup (./app.js:19:12)
The text was updated successfully, but these errors were encountered: