Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bindings for ssrExchange. Upgrade to urql 1.1.3. #111

Merged
merged 4 commits into from
Oct 16, 2019

Conversation

parkerziegler
Copy link
Contributor

@parkerziegler parkerziegler commented Oct 15, 2019

This PR adds bindings for the ssrExchange to reason-urql and upgrades our urql dependency to 1.1.3 馃帀 This will form the basis of our 1.1.0 release.

While binding this exchange didn't prove to be too difficult, getting a working example with NextJS was non-trivial. For the time being, I decided to skip it. A few things make this really hard:

  • The need for a server-side prepass step. I was actually able to successfully bind this: https://github.com/FormidableLabs/bs-react-ssr-prepass. However, the below considerations pushed this over the edge of feasibility currently.
  • The need for a higher order component to run the prepass step. Implementing HoCs in Reason is a fairly well known issue and I've never really been able to do it. This is the HoC we'd need to re-implement: https://github.com/FormidableLabs/urql/blob/master/examples/3-ssr-with-nextjs/src/with-urql-client.js Conversely, binding HoCs is possible, and I have an RFC open to create a next-urql package that we'd be able to bind to 馃帀 This should make things much easier in the near future, but also make our own support for the ssrExchange a bit moot.
  • General problems with having this example in source i.e. challenges with ES6 vs. CommonJs compilation and BuckleScript's weirdness around ES Modules and default imports / exports.

I don't want this feature to hold up development on other parts of reason-urql, so for now I've exposed the bindings and curious souls can venture forth with them if they want to!

@kitten I'd love any thoughts you might have on the above or feelings around how to make SSR easier here. Tagging @Schmavery and @gugahoa as well for visibility.

@parkerziegler parkerziegler merged commit 55a95c2 into master Oct 16, 2019
@parkerziegler parkerziegler deleted the task/ssrExchange branch October 16, 2019 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant