Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement deleteEdge store updater directive #3177

Closed
wants to merge 1 commit into from

Conversation

zth
Copy link
Contributor

@zth zth commented Sep 5, 2020

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.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@zth
Copy link
Contributor Author

zth commented Sep 5, 2020

cc @tyao1

Copy link
Contributor

@tyao1 tyao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for implementing this!

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tyao1 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@tyao1 merged this pull request in 01d65b3.

@zth zth deleted the delete-edge-directive branch September 30, 2020 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants