-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
feat(vue-app): new fetch syntax #6880
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
If you need any help please let me know. |
Codecov Report
@@ Coverage Diff @@
## dev #6880 +/- ##
=======================================
Coverage 62.66% 62.66%
=======================================
Files 82 82
Lines 3300 3300
Branches 898 898
=======================================
Hits 2068 2068
Misses 989 989
Partials 243 243
Continue to review full report at Codecov.
|
007c785
to
a84f31d
Compare
@pi0 @atinux
So I try the above code and it works fine on client-side, but if error happens during SSR I get So how this most common error handling pattern should implemented via new Fetch hook ? Thanks |
Hi @husayt Actually, since this happens in I will recommend to use I believe that with Vue 3 we may find an alternative to it 🤞 |
Thanks @atinux , For now the main benefit for me it seems that new fetch allows to asynchronously provide data at component level for both server and client side, which is itself is huge and allows new patterns not available to us before. Another gotcha with fetch is that it happens at the very end. Would be very interesting to explore firing data request in page middleware/asyncdata and awaiting in fetch |
Types of changes
Description
ℹ️ See RFC: nuxt/rfcs#27
ℹ️ See original pull request first: #5118
ℹ️ Documentation about its usage is available on https://github.com/nuxt/nuxt.js/tree/feat/new-fetch/examples/new-fetch
This PR is not a breaking change since it activates this new fetch only when
fetch
is used without expecting any arguments.Old fetch
With this pr, this syntax is now deprecated in favour of
middleware(context)
New fetch
Resolves #3776, #32 and #127
Checklist: