Closed gmsorrow closed 5 years ago
Why ?
We are always waiting for the result of
fetch
, it isdefer
which is deferred,defer
is not executed server side.If an operation should not be expected on either server side or client side then it should not be in a
provideHooks
.
To speed up interface If data is mandatory for server rendering, but can be deferred for frontend.
For example. Project has two pages Home, Contacts. Home page needs to fetch list of books only. Books fetch should use await on server to build entire page, but on client when user go to Home from Contacts he immediately sees a page with components and don't have to wait on books fetch.
The goal of fetch is to block the page loading time.
If you do not want to wait then do not return the promise in the provideHooks
, only for the client in your case.
Why ?
We are always waiting for the result of
fetch
, it isdefer
which is deferred,defer
is not executed server side.If an operation should not be expected on either server side or client side then it should not be in a
provideHooks
.