facebook / facebook/relay

Network fails cause useLazyLoadQuery to produce cryptic console errors

Open
#3,208 12 comments 6 reactions 0 assignees View on GitHub
bug
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Logging here, will edit with a repro after some more investigation.

---

Looks like if in the network layer if an exception was fired, and subsequently calls `execute.error`. That `useLazyLoadQueryNode` has no idea about this error, and still tries to run as normal. Which in turns leaves `preparedQueryResult` undefined, and causes `useFragmentNode` to try and get `.name` from undefined.

So my question is, should a network error still try and resolve a fragment?

#### Possibly `undefined`

https://github.com/facebook/relay/blob/a6ad4d857af6c11666f54f72eaca2f63fa0f2e58/packages/relay-experimental/useLazyLoadQueryNode.js#L67-L77

#### Leaving this to fail

https://github.com/facebook/relay/blob/a6ad4d857af6c11666f54f72eaca2f63fa0f2e58/packages/relay-experimental/useLazyLoadQueryNode.js#L121-L125

#### `fragmentNode` is undefined

https://github.com/facebook/relay/blob/a6ad4d857af6c11666f54f72eaca2f63fa0f2e58/packages/relay-runtime/util/getFragmentIdentifier.js#L67

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.