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
fix(nuxt): respect custom timeout in useFetch
#24364
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Codecov ReportAll modified and coverable lines are covered by tests β
Additional details and impacted files@@ Coverage Diff @@
## main #24364 +/- ##
=======================================
Coverage ? 58.76%
=======================================
Files ? 5
Lines ? 861
Branches ? 46
=======================================
Hits ? 506
Misses ? 355
Partials ? 0 β View full report in Codecov by Sentry. |
β Live Preview ready!
|
I've added a test to cover the change. I tried registering a new endpoint with a delay, however since internal requests don't make network requests, there was no effect. Therefore, this test does need to make a network request to an external URL. Is there a better one to use than this? |
You could probably use const { pending, status, error } = await useAsyncData(
() => new Promise(resolve => setTimeout(resolve, 5000)),
{ timeout: 1 }
) |
Thanks for this! I made an upstream tracker (unjs/ofetch#326) would you please add a TODO comment above about the migration plan and why we need this workaround today? ππΌ For ofetch, we are considering |
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.
Other than small comment LGTM thanks
useFetch
useFetch
Thank you β€οΈ |
π Linked issue
Fixes #24354
β Type of change
π Description
Implemented
timeout
option inuseFetch
as outlined in @danielroe's commentTested using the provided reproduction in the playground:
Before:
After:
π Checklist