Skip to content

Commit

Permalink
Enable updatable fragments
Browse files Browse the repository at this point in the history
Summary:
See D34813394 (c0a1b67) for a full explanation.

# This diff

* Enables updatable fragments
* Adds a few fixtures showing default behavior. This includes behavior that will be disallowed (e.g. directives on updatable fragment spreads)

Reviewed By: captbaritone

Differential Revision: D34810839

fbshipit-source-id: 5ee3203cf8644df95724a56e6fa312758738a143
  • Loading branch information
rbalicki2 authored and facebook-github-bot committed Mar 21, 2022
1 parent eace17e commit f199ede
Show file tree
Hide file tree
Showing 20 changed files with 819 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
==================================== INPUT ====================================
query updatableFragmentSpreadWithDeferQuery {
me {
...updatableFragmentSpreadWithDefer_user @defer
}
}

fragment updatableFragmentSpreadWithDefer_user on User @updatable {
firstName
}
==================================== OUTPUT ===================================
{
"fragment": {
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "updatableFragmentSpreadWithDeferQuery",
"selections": [
{
"alias": null,
"args": null,
"concreteType": "User",
"kind": "LinkedField",
"name": "me",
"plural": false,
"selections": [
{
"kind": "Defer",
"selections": [
{
"args": null,
"kind": "FragmentSpread",
"name": "updatableFragmentSpreadWithDefer_user"
}
]
}
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [],
"kind": "Operation",
"name": "updatableFragmentSpreadWithDeferQuery",
"selections": [
{
"alias": null,
"args": null,
"concreteType": "User",
"kind": "LinkedField",
"name": "me",
"plural": false,
"selections": [
{
"if": null,
"kind": "Defer",
"label": "updatableFragmentSpreadWithDeferQuery$defer$updatableFragmentSpreadWithDefer_user",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "firstName",
"storageKey": null
}
]
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
}
],
"storageKey": null
}
]
},
"params": {
"id": null,
"metadata": {},
"name": "updatableFragmentSpreadWithDeferQuery",
"operationKind": "query",
"text": null
}
}

QUERY:

query updatableFragmentSpreadWithDeferQuery {
me {
...updatableFragmentSpreadWithDefer_user @defer(label: "updatableFragmentSpreadWithDeferQuery$defer$updatableFragmentSpreadWithDefer_user")
id
}
}

fragment updatableFragmentSpreadWithDefer_user on User {
firstName
}


{
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "updatableFragmentSpreadWithDefer_user",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "firstName",
"storageKey": null
}
],
"type": "User",
"abstractKey": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
query updatableFragmentSpreadWithDeferQuery {
me {
...updatableFragmentSpreadWithDefer_user @defer
}
}

fragment updatableFragmentSpreadWithDefer_user on User @updatable {
firstName
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
==================================== INPUT ====================================
query updatableFragmentSpreadWithIncludeQuery($if: Boolean!) {
me {
...updatableFragmentSpreadWithInclude_user @include(if: $if)
}
}

fragment updatableFragmentSpreadWithInclude_user on User @updatable {
firstName
}
==================================== OUTPUT ===================================
{
"fragment": {
"argumentDefinitions": [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "if"
}
],
"kind": "Fragment",
"metadata": null,
"name": "updatableFragmentSpreadWithIncludeQuery",
"selections": [
{
"alias": null,
"args": null,
"concreteType": "User",
"kind": "LinkedField",
"name": "me",
"plural": false,
"selections": [
{
"condition": "if",
"kind": "Condition",
"passingValue": true,
"selections": [
{
"args": null,
"kind": "FragmentSpread",
"name": "updatableFragmentSpreadWithInclude_user"
}
]
}
],
"storageKey": null
}
],
"type": "Query",
"abstractKey": null
},
"kind": "Request",
"operation": {
"argumentDefinitions": [
{
"defaultValue": null,
"kind": "LocalArgument",
"name": "if"
}
],
"kind": "Operation",
"name": "updatableFragmentSpreadWithIncludeQuery",
"selections": [
{
"alias": null,
"args": null,
"concreteType": "User",
"kind": "LinkedField",
"name": "me",
"plural": false,
"selections": [
{
"condition": "if",
"kind": "Condition",
"passingValue": true,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "firstName",
"storageKey": null
}
]
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
}
],
"storageKey": null
}
]
},
"params": {
"id": null,
"metadata": {},
"name": "updatableFragmentSpreadWithIncludeQuery",
"operationKind": "query",
"text": null
}
}

QUERY:

query updatableFragmentSpreadWithIncludeQuery(
$if: Boolean!
) {
me {
...updatableFragmentSpreadWithInclude_user @include(if: $if)
id
}
}

fragment updatableFragmentSpreadWithInclude_user on User {
firstName
}


{
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"name": "updatableFragmentSpreadWithInclude_user",
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "firstName",
"storageKey": null
}
],
"type": "User",
"abstractKey": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
query updatableFragmentSpreadWithIncludeQuery($if: Boolean!) {
me {
...updatableFragmentSpreadWithInclude_user @include(if: $if)
}
}

fragment updatableFragmentSpreadWithInclude_user on User @updatable {
firstName
}
Loading

0 comments on commit f199ede

Please sign in to comment.