relay-tools / relay-hooks

Use Relay as React hooks
https://relay-tools.github.io/relay-hooks/docs/relay-hooks.html
MIT License
542 stars 56 forks source link

Highlight Issue: Todo example with Relay v15.0.0 and @required field #251

Closed eduardolundgren closed 1 year ago

eduardolundgren commented 1 year ago

Changes

Question

In addition to the above observations regarding the @required field with Relay v15.0.0, I'd like to ask if there are any plans or intentions to fully support Relay v15.0.0 in the near future? It would be helpful to know for those of us who are considering upgrading or building upon this version. Thank you.

relay-hooks relay
morrys commented 1 year ago

Hi @eduardolundgren, thanks for the PR 👍 I made some changes and drafted the PR.

As far as relay v15 support is concerned, the idea is to support it entirely with particular interest in features that are both concurrent and non-concurrent.

Being a project that I carry out in my free time, some of them may involuntarily escape me but I am always available to integrate them or evaluate PRs that do so.

eduardolundgren commented 1 year ago

All changes look good to me.

Given these @required enhancements, would it be possible to kindly consider releasing a new version with these changes?

Thanks for your hard work on this project.

morrys commented 1 year ago

Hi @eduardolundgren, this PR has been released https://github.com/relay-tools/relay-hooks/releases/tag/v8.0.1

let me know if there are any problems :)

eduardolundgren commented 1 year ago

Thank you, @morrys. I will test version 8.0.1 in the coming days and inform you of any issues.

eduardolundgren commented 1 year ago

Hi @morrys, we tested it on the product codebase, and it works as expected. We're investigating a use case that might be atypical: we want to invalidate the cache for the query that resulted in an exception from @required. I've noticed that the error thrown originates from inside a RelayObservable and doesn't bubble up. We'll continue our investigation, but I wanted to share this with you in case you have any insights on its feasibility. Having access to the component or query it came from, this could be achieved either by interacting with the relay store or by accessing the component instance and incrementing the fetchKey. Thanks.

morrys commented 1 year ago

Hi @eduardolundgren, have you tried opening an issue in relay? This seems like a problem that could be fixed in relay-runtime

eduardolundgren commented 1 year ago

@morrys I've noticed that the exception isn't thrown when @required is inside a fragment. Is this expected?

morrys commented 1 year ago

@eduardolundgren In the example project in this PR the error is thrown by the fragment.