Server rendering error on createResource. Inconsistent HMR.

I am currently get this error when calling npm run dev and npm run build just hangs.
GET http://localhost:3000/
An unhandled error occured: TypeError: Cannot read properties of undefined (reading 'id')
at Proxy.createResource (/Users/rexor/projects/fastsearch/solid/node_modules/solid-js/dist/server.cjs:412:35)
at /Users/rexor/projects/fastsearch/solid/src/components/Results.tsx:31:25
at async instantiateModule (file:///Users/rexor/projects/fastsearch/solid/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53364:9)
GET http://localhost:3000/
An unhandled error occured: TypeError: Cannot read properties of undefined (reading 'id')
at Proxy.createResource (/Users/rexor/projects/fastsearch/solid/node_modules/solid-js/dist/server.cjs:412:35)
at /Users/rexor/projects/fastsearch/solid/src/components/Results.tsx:31:25
at async instantiateModule (file:///Users/rexor/projects/fastsearch/solid/node_modules/vite/dist/node/chunks/dep-5605cfa4.js:53364:9)
The error refers to this file https://gist.github.com/DanteOz/ad4570b168da5fc5f8707bcd6069bba1, which imports a signal from this file https://gist.github.com/DanteOz/dfc2eb10e574af82c950aa5ad8d6c516. The page renders in HMR by replacing line 31 with export const results = () => []. If I then replace the original line the page is able to render and the reactivity with my Search component works, but results in a flicker. However, if I restart the dev server it once again breaks. I am using Solid Start with SSR set to false in vite.config.ts.
2 Replies
DanteOz
DanteOzOP2y ago
Seems like this is issue has already been reported https://github.com/solidjs/solid/issues/1390
GitHub
Cannot use createResource at the top of a module (build hang an...
Describe the bug First of all, let me preface this by saying I don't know if this is a bug or something in the behaviour of solidjs (or js in general) that I'm missing. I have a pre...
Want results from more Discord servers?
Add your server