Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error returned by useAsyncData is not immediately reflected #1001

Closed
wattanx opened this issue Dec 4, 2023 · 1 comment
Closed

error returned by useAsyncData is not immediately reflected #1001

wattanx opened this issue Dec 4, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@wattanx
Copy link
Collaborator

wattanx commented Dec 4, 2023

Environment


  • Operating System: Linux
  • Node Version: v18.18.0
  • Nuxt Version: 2.17.2
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: webpack
  • User Config: ssr, serverHandlers, devServerHandlers, devServer, typescript, nitro, bridge, buildModules
  • Runtime Modules: -
  • Build Modules: (), @nuxt/[email protected]

Reproduction

https://stackblitz.com/edit/github-dds6ys

Describe the bug

Error returned by useAsyncData is not immediately reflected.
We expect the environment to behave like the following:
https://stackblitz.com/edit/github-drhhpj

Additional context

Strangely enough, it works when properties other than error are used together!

<script setup>
const { error, status } = useLazyAsyncData('aaa', async () => {
  try {
    throw new Error('test')
  } catch (e) {
    throw { obj: 'test' }
  }
})
</script>

<template>
  <div>
    <p>error: {{ error !== null }}</p>
    <p>status: {{ status }}</p>
  </div>
</template>

Logs

No response

@wattanx
Copy link
Collaborator Author

wattanx commented Dec 20, 2023

Fixed at #1004

@wattanx wattanx closed this as completed Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant