Open mongjong59 opened 7 years ago
Hey @nostophilia, I haven't tried server side rendering with relay yet. You can checkout this repo, https://github.com/brandfolder/rails-graphql-relay (looks outdated though). I will look into this too.
@gauravtiwari Seems we can get it work by means of React on Rails Node.js SSR (I pushed a fix on the server file, merged with v6.5.0).
However it doesn't seem an ideal way as it means extra Rails call stack which is not necessary. It would be great if we can:
Schema.execute(query)
This seems more feasible with Relay as the code of Isomorphic React Relay implies while the getQueriesFromTree
of Apollo doesn't seem to return root queries with all sub-queries. Do you have idea whether there's an API for extracting root queries in Relay or Apollo and do they both support store hydration?
I tried to set up server-side rendering with
isomorphic-relay
. But I got stuck because it seems that with ExecJS (with Node.js backend), Promises can't be consumed. I tried a very basic Promise in my server startup file.The above code will log [Object Promise]. But normally it should be
foobar
and{}
. I didn't find much about whether Promise are supported in ExecJS. But this is obviously a key in server-side rendering with a GraphQL client. Do you have any idea on this issue?