Getting "Cannot read properties of undefined" errors when reading from Relay store
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
In Sentry, I'm seeing a lot of issues like this

The corresponding code looks like this:
```
return (
{data.metadataAccountsForExplore.metadataAccounts.edges.map(
({ node: metadataAccount }) => (
...
)
)}
);
```
This is unexpected, because the Relay compiler generates a non-nullable type for `data.metadataAccountsForExplore`.
Most of these errors involve a user navigating from `/explore` to another page, and then back to `/explore`. As you can see in the Sentry screenshot (first screenshot), there are no additional queries kicked off when the user navigates back to `/explore`. This suggests the issue may be related to reading from the Relay store.
This hypothesis is at odds with [Relay's documentation](https://relay.dev/docs/guided-tour/reusing-cached-data/fetch-policies/) though:
> By default, Relay will try to read the query from the local cache; if any piece of data for that query is [missing](https://relay.dev/docs/guided-tour/reusing-cached-data/presence-of-data/) or [stale](https://relay.dev/docs/guided-tour/reusing-cached-data/staleness-of-data/), it will fetch the entire query from the network. This default fetchPolicy is called "store-or-network".
So basically, I have no idea why this is happening.
## Edit
In my local dev environment, I am able to reproduce this consistently by using `gcReleaseBufferSize: 0` and clicking between pages
Contributor guide
Assessment
This issue has not been assessed yet.