relay: [Modern-rc.2] RelayStaticSelector is searching for a wrong prop name

In rc.2, queries without fragments work fine. Queries with fragments started to break because Relay is not able to find fragment data in the response.

The query is assembled correctly, and the server response is in the right shape. However, when I pass the expect prop down to the Relay(MyContainer), I get this error from RelayStaticSelector -

Warning: RelayStaticSelector: Expected object to contain data for fragment `myProp`,
got `{"__fragments":{"MyContainer_myProp":{}},"__id":"client:root:topquery"}`. 
Make sure that the parent operation/fragment included fragment `...myProp`

Seems like StaticSelector is ignoring the expect prefix for the fragment, and is sniffing for myProp instead of MyContainer_myProp which is how it is embedded in the query

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 9
  • Comments: 33 (14 by maintainers)

Commits related to this issue

Most upvoted comments

This is fixed in d7c5750, which will go out in the next RC. Thanks again all for the bug reports and repro examples!

Thanks for the extra details. I debugged and reproduced this, it looks like this was introduced in RC2 and is caused by the output of graphql tags not being unwrapped when in full-Modern mode. We’re working on a fix.

We’ll follow up here, stay tuned!

I’m getting the same issue here.

Anyone still seeing this on RC3? Cool to close?

when will it release?

Damn, wish I’d looked for this issue earlier, I just wasted a good few hours on this assuming it was my error. But yes, data for child fragments isn’t being constructed correctly to pass down the render tree.

FWIW, todo-modern also breaks with the same error if I change it to skip the compat layer.

Here’s the smallest delta to the original example that will demonstrate this issue https://github.com/relayjs/relay-examples/compare/master...eugene1g:master