facebook / facebook/relay

"Uncaught TypeError: Cannot read property 'identifier' of undefined" when calling `retain()` in Relay 8.0.0

Open
#2,997 21 comments 2 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

This is in an example 1:1 from the official documentation https://relay.dev/docs/en/local-state-management

```
commitLocalUpdate(modernEnvironment, store => {
const dataID = 'client:store';
const record = store.create(dataID, 'Store');

modernEnvironment.retain({
dataID,
variables: {},
node: {selections: []},
});
});
```

that causes the following error:

```
Uncaught TypeError: Cannot read property 'identifier' of undefined
at RelayModernStore.retain (RelayModernStore.js:158)
at RelayModernEnvironment.retain (RelayModernEnvironment.js:223)
```

I did a bare bones setup based on `relay-examples` todo app. Nothing fancy.

Not sure if related: https://github.com/facebook/relay/issues/2971

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.