Urql: Fetching data on the server, or SSR in other words

Created on 5 Feb 2018  Â·  6Comments  Â·  Source: FormidableLabs/urql

I get why SRR is low on the prioritization list seing you guys have other features to bake first, but I'm wondering where it is in your pipeline and what your initial thoughts are for implementing it.

And how can we help?

Most helpful comment

Its #1 on the todo https://github.com/FormidableLabs/urql#todo

Right now I'm trying to stabilize the API and shake out some introductory bugs. Past that, I would assume there will be a two pass render, where we walk the tree, identify queries, execute and cache them, and then serialize the cache. Then add a hydration helper on the client side. Does that sound about right?

All 6 comments

Its #1 on the todo https://github.com/FormidableLabs/urql#todo

Right now I'm trying to stabilize the API and shake out some introductory bugs. Past that, I would assume there will be a two pass render, where we walk the tree, identify queries, execute and cache them, and then serialize the cache. Then add a hydration helper on the client side. Does that sound about right?

Sounds about right! Would be cool if we could also control how and which queries should be executed on the server vs client, one unique feature could be to resolve the queries using your schema directly if the SSR is served from the same server as your GraphQL endpoint. Would be rad 🥇.

Did this ever get implemented? I don't see any references to SSR anymore.

@chrischen Not yet unfortunately! We haven't found a way yet to traverse a React element tree and extract pending requests with hooks.

Here's an implementation from graphql-react.

https://github.com/jaydenseric/graphql-react/blob/master/src/server/ssr.mjs https://github.com/jaydenseric/graphql-react/blob/master/src/server/ssr.mjs

On Feb 26, 2019, at 7:40 PM, Phil Plückthun notifications@github.com wrote:

@chrischen https://github.com/chrischen Not yet unfortunately! We haven't found a way yet to traverse a React element tree and extract pending requests with hooks.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/FormidableLabs/urql/issues/36#issuecomment-467406080, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGsPlH2ZuPZI8L9zR-jldhUEc82RDBwks5vRR0ogaJpZM4R4_g0.

@chrischen yea, I've dabbled with getDataFromTree implementations before, but I'm put off by the newer approaches of repeatedly rendering to static markup and waiting for a promises / operations array to come back empty

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pix2D picture pix2D  Â·  4Comments

wodnjs6512 picture wodnjs6512  Â·  3Comments

tgrecojs picture tgrecojs  Â·  4Comments

davidhouweling picture davidhouweling  Â·  4Comments

BjoernRave picture BjoernRave  Â·  3Comments