fastify / fastify-dx

Archived
903 stars 43 forks source link

Solid support #27

Closed galvez closed 2 years ago

galvez commented 2 years ago

This is where Solid support stands.

All examples are working except the streaming one.

All examples are working now.

Lesson learned re: streaming issue: renderToStream() must be imported from the Vite bundle, you can't load Solid code from the Vite-managed environment and renderToStream() straight from the Node.js environment. It all must be loaded from the same Vite-managed environment.

lxsmnsyc commented 2 years ago

I'm not sure why you need to define the sharedConfig. Wrapping the root with Suspense should be enough to allow async/streaming to work.

galvez commented 2 years ago

Thank you @LXSMNSYC — Indeed wrapping the root in Suspense appears to do something, but it's not quite there.

galvez commented 2 years ago

I'll follow up with more info as soon as I can.

galvez commented 2 years ago

@LXSMNSYC No dice — wrapping the root in Suspense now gives me this error:

$ node server.js --dev
TypeError: ctx.writeResource is not a function
    at Suspense (/Users/jonas/Fastify/fastify-dx/starters/solid/node_modules/solid-js/dist/server.cjs:511:9)
    at Proxy.createComponent (/Users/jonas/Fastify/fastify-dx/starters/solid/node_modules/solid-js/dist/server.cjs:252:15)