Idea | `useAsyncData` options like `onError`, `onSuccess`, (`onPending` and `onIdle`)
Open
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:
- https://github.com/nuxt/nuxt/issues/31743
- maybe https://github.com/nuxt/nuxt/issues/28557
- and maybe many more
Additional information
- Would you be willing to help implement this feature?
- Could this feature be implemented as a module?
Final checks
- Read the contribution guide.
- Check existing discussions and issues.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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