facebook / facebook/relay

@append/prependEdge behavior when node already exists

Open
#3,838 3 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

Today, since https://github.com/facebook/relay/pull/3373 got merged, when using `@append/prependEdge` on an already existing node, no node is appended/prepended.

I get that the previous behavior (ie adding a duplicate node) was broken, but I still think that the current behavior is not ideal, shouldn't we instead move the existing node to bottom/top instead of doing nothing?

If you think the current behavior is still sometimes wanted, we could add an additional parameter like:
```
@prependEdge(whenExists: false)
```

Would you be open to a PR that corrects this behavior?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing pull request 3373 and the implementation of @appendEdge and @prependEdge to understand the current duplicate-node behavior. Compare the proposed alternatives—moving an existing node or adding a whenExists parameter—and identify the expected semantics before locating relevant tests. Done means the behavior is agreed and covered by tests for existing and new nodes.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
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.