facebook / relay

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

improve reporting resolver failures #3900

Open voideanvalue opened 2 years ago

voideanvalue commented 2 years ago

I was trying to introduce resolvers to relayjs/relay-examples (in the nextjs example, manually hacked around the haste style requires printed by the compiler). I couldn't figure out why things weren't working for the longest time. The resolver module factory was getting executed but the resolver function didn't. Noting down some thoughts here for future me.

captbaritone commented 2 years ago

I have a TODO somewhere to rename requiredFieldLogger. It's on my list. We also need to update the types (Flow and Typescript) to make that logger non-optional.

CC @tbezman: Heads up about the module resolution issue with Resolvers and default exports.

sibelius commented 1 year ago

we got this error

Relay Environment Configuration Error (dev only): `@required(action: LOG)` requires that the Relay Environment be configured with a `requiredFieldLogger`.
    at RelayModernEnvironment.defaultRequiredFieldLogger [as requiredFieldLogger]

is this related ?

voideanvalue commented 1 year ago

@sibelius I think that's different... it's saying that @required(action: LOG) is being used but the RelayEnvironment instance you're using doesn't have requiredFieldLogger configured