Using Client data object with no ID
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying out the experimental [Relay Resolvers](https://relay.dev/docs/guides/relay-resolvers/) on the client to manage state for a small app. When having a client resolver, it seems like it should be possible to return any type from the schema. In my case, I want to return a tuple (ex. `type Point { x: Int y: Int }`). However, I get the following error:
> Expected this Client Edge Relay Resolver to return an ID of type `string` or an object with shape {id}.
This is after I enabled `RelayFeatureFlags.ENABLE_CLIENT_EDGES = true`; before that, I got an error:
>Client edges are not yet supported
It seems like it should be possible to just directly return an object with the correct shape (I don't want persistent objects with an ID in this case, similar to a string or boolean).
My module looks like this:
```
/**
* @RelayResolver Query.weather: WeatherData
*/
export async function weather(key: any): Promise {
const location = await fetchLocation();
return await fetchWeather(location);
}
```
Where WeatherData is typed in the schema as:
```
type WeatherData {
elevation: Int
temperature: Int
}
```
(As a side note, I noticed the function had to be named the same as the field (ex. in this case `weather`), which wasn't well-documented and led to some confusion)
Contributor guide
Assessment
This issue has not been assessed yet.