Unexpected suspense from useLazyLoadQuery that only spreads fragments
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Lets say we have a `useLazyLoadQuery` that only spreads other component's fragment
```
const data = useLazyLoadQuery(
graphql`
query MyQuery {
...MyFragment
}
`,
{}
)
```
if i understand correctly, this `useLazyLoadQuery` should never suspend since it does not query for any data directly which falls into the partial rendering scenario, instead, the component that uses `MyFragment` might suspend if data is not available in the cache.
However, we recently noticed that if any data that is part of the `MyFragment` got invalidated(`store.get().invalidate()`), the `useLazyLoadQuery` will start throwing promise on the next render. Looking into the [relay internals](https://github.com/facebook/relay/blob/main/packages/react-relay/relay-hooks/QueryResource.js#L410), if a query is stale, `canPartialRender` will always be false despite the query doesn't have any data dependencies. Wondering if this is by design? Thank you.
Contributor guide
Assessment
This issue has not been assessed yet.