facebook / facebook/relay

`GraphQLList`: Can it handle append/preprend/delete?

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

Description

Can ordinary, flat lists be safely updated in mutations (e.g. adding, removing, updating an item?)

Does the relay specification define this?

[Mutations API](https://relay.dev/docs/v1.5.0/mutations/#range_delete) have access to [`RANGE_ADD`](https://relay.dev/docs/v1.5.0/mutations/#range_add) ([`@appendEdge`](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#order-of-execution-of-updater-functions)?), [`RANGE_DELETE`](https://relay.dev/docs/v1.5.0/mutations/#range_delete) ([`@deleteRecord`](https://relay.dev/docs/guided-tour/updating-data/graphql-mutations/#order-of-execution-of-updater-functions)?)

Suppose `GraphQLList` don't work with those above features, is there any in the existing mutation specification to simulate adding, deleting, updating a single item?

How close can you get to connection-like behavior without needing to use a structure shaped like `edges.node`?

History: Unsettled issue from relay classic: https://github.com/facebook/relay/issues/444, https://github.com/facebook/relay/pull/1292

Contributor guide

Open the contributing guide

Research direction

Start with the Relay v1.5.0 mutation documentation linked in the issue, especially RANGE_ADD/RANGE_DELETE and @appendEdge/@deleteRecord, then compare the earlier Relay issue #444 and pull request #1292. Done would be a documented, settled answer or an explicitly scoped implementation path for updating flat GraphQLList values without connection-shaped data.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.