graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Incomplete relay implementation

Open 8byr0 opened this issue 3 years ago • 11 comments

Is your proposal related to a problem?

TL;DR; Relay implementation is currently lacking most of hasura's best features. This issue summarises all the missing points.

When I started using Hasura, I was amazed by all the power out of nothing, it really improved my dx and my workflow. In order to get even more productive I gave a try to relay endpoint and... it is so frustrating! As of now, only connections are implemented at root level; no views, no aggregations... I know this is related to the way relay is designed (uniqueness of id) but then it's not usable at all for a big project (i.e. the actual purpose of relay). For example if I want to use both aggregations and pagination features(out of relay) while taking advantage of client-side implementation (fragment based w/ relay compiler) it's not possible: I have to trick by using both relay client and another one (apollo, urql...).

Describe the solution you'd like

There are two possibilities:

  1. Community shows interest for using relay w/ hasura (which I hope)
  2. No one cares for it

If community cares, we (hasura team & community) could discuss priority of all missing features and vote? On the other hand if no one wants to use it and it's stated that no changes will be done on it (actual position of hasura when asking about roadmap) then there should be bigger disclaimers not to use relay at all(except if your need is to make a blog - but hasura may not be the best tool for it).

Today, relay is growing fast(new major version being released by facebook soon with improved compiler) and is IMHO a really good tool for large codebases. The main pain with it is documentation / discussion around: many topics are 2-3 years old and not relevant regarding actual codebase. I was so grateful to find this video where hasura explains how to deep dive in it and understand main principles (actually the best one to start learning relay).

I was really enthusiast when reading all hasura announcements about relay support and the documentation stating that things may get better soon but 1.5 years later nothing seems to have moved on this particular point: image

Here's a list of features:

  • [x] Global object identification - normal table with pk id
  • [ ] SQL Views queries
  • [ ] Aggregations queries
  • [x] Connections (with cursor based pagination)
  • [ ] Other db than Postgres
  • [ ] Persisted queries
  • [ ] remote schemas
  • [ ] actions

This list probably lacks a lot of items, I wrote the one I noticed/were stated in official limitations so please comment below and I'll edit.

Describe alternatives you've considered

N/A

If the feature is approved, would you be willing to submit a PR?

Would be a pleasure but I need to learn Haskell first (fullstack JS dev here)

8byr0 avatar Dec 17 '21 08:12 8byr0

Relevant discussions:

  • https://github.com/hasura/graphql-engine/discussions/6359
  • https://github.com/hasura/graphql-engine/discussions/7795
  • https://github.com/hasura/graphql-engine/discussions/6277
  • https://github.com/hasura/graphql-engine/discussions/7371

8byr0 avatar Dec 17 '21 08:12 8byr0

Thanks Hasura team for all the hard work and the great platform. Although not included in the list, this issue is also relevant:

  • #7721

I look forward to this feature being added.

sho-hata avatar Dec 20 '21 15:12 sho-hata

Thanks @8byr0 for this initiative. When implementing a webapp with React and Graphql, it's natural to use Relay! It's just the best option (IMO). I've been working for ~8 months now with Hasura, and there are many limitations and bugs when using Relay endpoint:

  1. Aggregations queries are missing
  2. SQL Views queries are missing
  3. Actions are missing
  4. Some order_by throw exception (not sure what's the root cause, I think it happens when two or more tables being queries have the same column name that you are ordering by)

How can we vote/push for Relay to be considered at all?

matiasf9 avatar May 25 '22 18:05 matiasf9

Hasura not supporting actions with relay was basically something that made me choose to maybe not use relay at all and maybe hasura in future personal projects. Since I'm mostly a front-end developer, i will not create my own graphQL server just to use relay.

Since i wanted to use graphQL only with relay, maybe i will just not use graphQL at all until hasura supports at least actions. I really hope that they have plans in near future to improve the relay implementation and maybe not focus so much on other stuff like supporting so many databases for example.

arachnidiskandar avatar Jun 27 '22 01:06 arachnidiskandar

+1

PedroBern avatar Oct 09 '22 11:10 PedroBern

Is this still on the roadmap?

wieseljonas avatar Jan 26 '23 07:01 wieseljonas

+1 for wanting to use Hasura with Relay, but unable to without actions and view support

samfweb avatar Mar 10 '23 00:03 samfweb

I would be interested in hearing from any others that might be in a similar position but I've been using Hasura with Relay without the compatibility layer enabled. I've had to have some workarounds in terms of using UUID for globally unique ids in Relay (I can't remember if Apollo also has this requirement).

So far, so good, although I haven't implemented anything that you would normally use @connections for - I'm hoping I can get away with manually managing the pagination.

That said, I do think Apollo would have been a better fit and I'm a bit worried I might have to retro fit it in at some point 😬

Rodeoclash avatar Apr 17 '23 11:04 Rodeoclash

Anyone knows what this is? https://github.com/hasura/hasura-relay-client

Last commit was 2 weeks ago. Anyone know what they are up to? 🙂

EloB avatar Jul 24 '23 09:07 EloB

@EloB Hey, I was exploring some different ways a Relay-like API could work.

For Hasura v3, we have committed to the Relay spec as is. Expect to see some updates soon!

You can sign up here (https://hasura.io/ddn) to be the first to try out our Relay enabled APIs.

nullxone avatar Sep 29 '23 04:09 nullxone