facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.38k stars 1.82k forks source link

Avoid running resolver code if root fragment throws with @required(action: THROW) #4799

Closed captbaritone closed 1 week ago

captbaritone commented 1 week ago

I noticed a bug here. In order for the types generated by adding @required(action: THROW) to a resolver fragment to actually be safe, we need to short circuit and avoid calling the resolver function if the field has thrown.

This lays the ground work for the other bit we need, which is handling @throwOnFieldError errors and ensuring we never run a resolver with a fragment that should throw on read.

facebook-github-bot commented 1 week ago

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 1 week ago

@captbaritone merged this pull request in facebook/relay@dec5eec70ea0e5b68470575829fcb751a27939d4.