Does createAsync cause double renders on the server i.e an extra render after data becomes available

Was observing from the logs
(procirement) route
ProcurementProvider
getProcurementRouteData
routedata is undefined
getting data [ 'a', 'b', 'c' ]

(procirement) route
ProcurementProvider
routedata is {
a: ...,
b: {
...
},
c: 10485.2
}
(procirement) route
ProcurementProvider
getProcurementRouteData
routedata is undefined
getting data [ 'a', 'b', 'c' ]

(procirement) route
ProcurementProvider
routedata is {
a: ...,
b: {
...
},
c: 10485.2
}
4 Replies
bigmistqke
bigmistqke3d ago
By default createAsync serialises the promise and passes it over the wire. This means that it can start fetching on the server and immediately start streaming the rest of the application. Then once the fetch is resolved it streams the result in and lifts all the related suspense-boundaries. If you don't want to send the application before the createAsync is resolved you can set its deferStream-option.
Sudhagar
SudhagarOP3d ago
deferStream: true/false doesn't have any different - both the cases, the components runs twice. I haven't set deferStream. This is what I understand is happening. Correct me if I am wrong. Server does a render of the component when client requests for it the first time and streams whatever HTML it has over the wire. Now when async resolves on the server side and again the server does render of the component.
bigmistqke
bigmistqke3d ago
A you mean re-rendering as in the component literally re-runs. That is very unusual for solidjs, so i think there must be something else going on.
Atila
Atila21h ago
no, that second render shouldn't happen. Is the function you're passing to createAsync wrapped in a query() ? Query will cache/deduplicate the request, otherwise I can see the request firing more than once, specially in Dev
Want results from more Discord servers?
Add your server