-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement deleteEdge store updater directive (#3177)
Summary: _This supersedes #3148 which I've now closed._ This implements a new declarative for updating the store declaratively after mutations called `deleteEdge`. As the name hints at, this particular directive allows you to remove a node's edge from the provided connections. Please note that this directive does not _delete the node_, only edge(s) for the node. There's `deleteRecord` already for deleting a record, which can be combined with this directive. It's intended to be used like this: ``` mutation DeleteComment($input: DeleteCommentInput!, $connections: [String!]!) { deleteComment(input: $input) { deletedCommentId deleteEdge(connections: $connections) # This will delete any edge for the node with id `deletedCommentId` from the # connections provided through `$connections` } } ``` It works for single IDs (as demonstrated above) as well as a list of IDs. Pull Request resolved: #3177 Reviewed By: kassens Differential Revision: D23652072 Pulled By: tyao1 fbshipit-source-id: 0d41dd0bb4950276bd8a8fb9178b1ee9d0a4337d
- Loading branch information
1 parent
de38d41
commit 01d65b3
Showing
13 changed files
with
675 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...elay-compiler/codegen/__tests__/fixtures/compileRelayArtifacts/delete-edge-plural.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mutation CommentsDeleteMutation( | ||
$input: CommentsDeleteInput | ||
$connections: [String!]! | ||
) { | ||
commentsDelete(input: $input) { | ||
deletedCommentIds @deleteEdge(connections: $connections) | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/relay-compiler/codegen/__tests__/fixtures/compileRelayArtifacts/delete-edge.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
mutation CommentDeleteMutation( | ||
$input: CommentDeleteInput | ||
$connections: [String!]! | ||
) { | ||
commentDelete(input: $input) { | ||
deletedCommentId @deleteEdge(connections: $connections) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.