Christian
Solid-Start vinxi/http issue with useWebRequest
Actually same issue persists, what's the correct way to handle this? I know it's from the use server part but how do I get the user using SSR along side a createResource, unless I should be using a different SSR fetching method?
ReferenceError: Cannot access 'fetchUser' before initialization
14 replies
Solid-Start vinxi/http issue with useWebRequest
Interesting, I figured "use server" applied to the thing below it, thanks.
Creates a new issue as it complains fetchUser now doesn't exist as it's only server-sided code but that makes sense, but I think I can just solve it by doing what you recommend by moving it outside the UserProvider component into the main app and just passing in my user via props instead to the context
14 replies
Route Intercepting
I guess my main issue is I need a way to use middlewares as I was having issues when trying, I'm still on SolidStart 0.3.10, and not sure why when I try to use @solidjs/start/server and use defineConfig from it I get issues, obviously my backend routes are protected but wanted to prevent them from seeing the page overall. I know I could onMount and redirect and prevent content from showing, and or just check it on a createResource / server side fetching on page but seemed like jank solutions compared to doing middleware which I want to get working.
10 replies
createResource - SSR / SPA
For anyone that stumbles across it, switching the fetching to just be in the route and using routeData and useRouteData with createResource, and using a Suspense seemed to fix it, not exactly what I wanted but I'll manage.
18 replies
createResource - SSR / SPA
Changing it to
Show when={data()}/>
seems to fix the hydration errors, but then its back to blocking the entire rendering, so then I triedShow when={!data.loading && data()}/>
which has the same issue of it works on a setTimeout but not instant and causes hydration issues again18 replies
createResource - SSR / SPA
Oh interestingly enough actually, when I remove the timeout for delaying it, I do get the hydration error back.
This is with the original mock, all I changed was the fetchData function, and am now only using the createResource, so using data().data for the <For each={}>, and <Show when={!data.loading}/>
Nothing else was changed, and it seems to be resolved when I just add a delay to the data fetching function, 1ms doesn't work, 500ms doesn't work, but 1s did work, so not sure what exactly is the issue.
The error after I clear errors and retry seems to be alluding to the fact that <Show when={!data.loading}/> isn't working correctly or it seems to be saying it's done ahead of time, unsure, because it says cannot read properties of null (reading 'data') so when I'm doing data().data it's null, which it shouldn't hit unless data.loading is false.
Changing it from <Show> to <Suspense> seems to make it work SLIGHTLY better, but it will still error every other refresh with the same issue of data() is undefined.
18 replies