Samual 🦢
set response header from within `createServerData$()` callback
judging by https://github.com/solidjs/solid-start/blob/043577a6400b8461baa2345e70b665f86da9692f/packages/start/server/server-functions/server.ts#L160 it doesn't look like this is fixable
8 replies
set response header from within `createServerData$()` callback
that only fixes initial server render though
for when the resource is invalidated and the client side router is fetching the data again
useRequest().responseHeaders
is undefined
even at the beginning of the callback8 replies
set response header from within `createServerData$()` callback
okay I figured it out,
useRequest().responseHeaders
is defined at the beginning of the callback
but as soon as the callback await
s something, it becomes undefined
but if you save a reference to it to a variable
making changes still works even after an await
so the lesson is always have useRequest()
at the top of a function if you plan on using it8 replies