nuxt / nuxt/nuxt

Idea | `useAsyncData` options like `onError`, `onSuccess`, (`onPending` and `onIdle`)

Open
#34,308 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion pending triage
Dominant language
TypeScript
Stars
60.9k
Forks
5.8k
Avg merge
7h 8m
Merged PRs (30d)
162

Description

Describe the feature

This way we could for example add error handling without having to watch the error ref.

useAsyncData(()=>Promise.resolve(), {onError: (ctx, error)=>{
  console.error(error)
  toast.add(/*...*/)
})

This should solve:

Additional information
  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?
Final checks

Contributor guide

Open the contributing guide

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

The issue names useAsyncData as the entry point; start by locating its implementation and current error, pending, success, and idle state handling. Review linked issues 31743 and 28557, then define the callback behavior and tests needed for the proposed options. Done means the agreed API is implemented and covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxt, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.