You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In server side rendering. ComponentDeep1 has useQuery(query1) call and same on ComponentDeep2. ComponentDeep1 supports null state during loading, so ComponentDeep2 can be rendered concurrently inside instead of waiting useQuery is finished.
the problem here, ComponentDeep1 does not render ComponentDeep2 until useQuery(query1) is finished.
and after query1 is finished, it renders ComponentDeep2 and useQuery(query2) is started.
so total duration equals duration(query1) + duration(query2). and if we have more deep components, it significantly increases duration of initial loading.
This issue happens at only server side rendering. In the browser, useQuery does not block template rendering and it updates html for both cases of loading state and content with data. and all useQuery apis triggers in parallel. so total duration is calculated as max(duration(query1), duration(query2)) which is great!
The solution you'd like
Even on server side rendering, nuxt can render html template during useQuery is in loading state, and update html once data is resolved. so that this will not block api starting timing on children components. so that all useQuery apis runs in parallel. and total duration becomes as max(duration(query1), duration(query2)).
Possible alternatives
As a alternative way, we will have all query in single root component, preserve state into children by using provide('api', {data1, data2}). and inject corresponding data in child. but this require additional maintenance and ban to single component responsibility of SOLID principle.
Additional information
No response
The text was updated successfully, but these errors were encountered:
Your use case
I have several hierarchy component structure
for example:
In server side rendering.
ComponentDeep1
hasuseQuery(query1)
call and same onComponentDeep2
.ComponentDeep1
supportsnull
state during loading, soComponentDeep2
can be rendered concurrently inside instead of waitinguseQuery
is finished.the problem here,
ComponentDeep1
does not renderComponentDeep2
untiluseQuery(query1)
is finished.and after
query1
is finished, it rendersComponentDeep2
anduseQuery(query2)
is started.so total duration equals
duration(query1) + duration(query2)
. and if we have more deep components, it significantly increases duration of initial loading.This issue happens at only server side rendering. In the browser,
useQuery
does not block template rendering and it updates html for both cases of loading state and content with data. and alluseQuery
apis triggers in parallel. so total duration is calculated asmax(duration(query1), duration(query2))
which is great!The solution you'd like
Even on server side rendering, nuxt can render html template during useQuery is in loading state, and update html once data is resolved. so that this will not block api starting timing on children components. so that all
useQuery
apis runs in parallel. and total duration becomes asmax(duration(query1), duration(query2))
.Possible alternatives
As a alternative way, we will have all query in single root component, preserve state into children by using
provide('api', {data1, data2})
. and inject corresponding data in child. but this require additional maintenance and ban tosingle component responsibility
ofSOLID
principle.Additional information
No response
The text was updated successfully, but these errors were encountered: