-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
feat(nuxt): use AbortSignal to abort asyncData
#32918
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
Conversation
|
|
huang-julien
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
|
I think we still need to cancel previous promise (if still running) with the last signal 👀 |
I will add this. Maybe you could share your thoughts on how we should propagate this error: (+ this should be |
Isnt this done here? |
|
With the current implementation, the status is |
I have not found a clean solution yet. I will check again tomorrow. 😄 |
execute()
// status.value -> pending
execute()
// status.value -> pending
execute()
// status.value -> pending
// status.value -> success
execute()
// status.value -> pending
clear()
// status.value -> idle + requets aborted
const ac = new AbortController()
execute({signal: ac.signal})
// status.value -> pending
ac.abort(new WhatEverError())
// status.value -> error
execute({timeout: 10})
// status.value -> pending
// status.value -> error |
|
ToDos:
|
🔗 Linked issue
📚 Description
Based on @huang-julien #32531 - swapping exposed AbortController for exposed AbortSignal + adding timeout to asyncData.
Opening this as PR to better discuss some of the POC changes.