-
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.
Demonstrate client edges getting swallowed
Reviewed By: alunyov Differential Revision: D37112971 fbshipit-source-id: 7dde52800458ba5f23e2af4c68d5035cf32aa17a
- Loading branch information
1 parent
ec1bed6
commit b193cad
Showing
3 changed files
with
247 additions
and
1 deletion.
There are no files selected for viewing
198 changes: 198 additions & 0 deletions
198
...ates/relay-compiler/tests/compile_relay_artifacts/fixtures/multiple-client-edges.expected
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,198 @@ | ||
==================================== INPUT ==================================== | ||
fragment multipleClientEdges_best_friend_resolver on User { | ||
actor_key | ||
} | ||
|
||
fragment multipleClientEdges_worst_enemy_resolver on User { | ||
actor_key | ||
} | ||
|
||
query multipleClientEdgesQuery { | ||
me { | ||
best_friend { | ||
name | ||
} | ||
worst_enemy { | ||
name | ||
} | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
name: String | ||
} | ||
|
||
extend type User { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "multipleClientEdges_best_friend_resolver" | ||
import_path: "./foo/bar/baz/BestFriendResolver.js" | ||
) | ||
} | ||
|
||
extend type User { | ||
worst_enemy: ClientUser | ||
@relay_resolver( | ||
fragment_name: "multipleClientEdges_worst_enemy_resolver" | ||
import_path: "./foo/bar/baz/WorstEnemyResolver.js" | ||
) | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"fragment": { | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": { | ||
"hasClientEdges": true | ||
}, | ||
"name": "multipleClientEdgesQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "User", | ||
"kind": "LinkedField", | ||
"name": "me", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"kind": "ClientEdgeToClientObject", | ||
"concreteType": "ClientUser", | ||
"backingField": { | ||
"alias": null, | ||
"args": null, | ||
"fragment": { | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "multipleClientEdges_best_friend_resolver" | ||
}, | ||
"kind": "RelayResolver", | ||
"name": "best_friend", | ||
"resolverModule": require('BestFriendResolver'), | ||
"path": "me.best_friend" | ||
}, | ||
"linkedField": { | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "ClientUser", | ||
"kind": "LinkedField", | ||
"name": "best_friend", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "multipleClientEdgesQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "User", | ||
"kind": "LinkedField", | ||
"name": "me", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "actor_key", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "id", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
] | ||
}, | ||
"params": { | ||
"cacheID": "f025e3b1fa71b0e5fb8b91b7240b401d", | ||
"id": null, | ||
"metadata": {}, | ||
"name": "multipleClientEdgesQuery", | ||
"operationKind": "query", | ||
"text": null | ||
} | ||
} | ||
|
||
QUERY: | ||
|
||
query multipleClientEdgesQuery { | ||
me { | ||
...multipleClientEdges_best_friend_resolver | ||
...multipleClientEdges_worst_enemy_resolver | ||
id | ||
} | ||
} | ||
|
||
fragment multipleClientEdges_best_friend_resolver on User { | ||
actor_key | ||
} | ||
|
||
fragment multipleClientEdges_worst_enemy_resolver on User { | ||
actor_key | ||
} | ||
|
||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "multipleClientEdges_best_friend_resolver", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "actor_key", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "multipleClientEdges_worst_enemy_resolver", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "actor_key", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} |
41 changes: 41 additions & 0 deletions
41
...rates/relay-compiler/tests/compile_relay_artifacts/fixtures/multiple-client-edges.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,41 @@ | ||
fragment multipleClientEdges_best_friend_resolver on User { | ||
actor_key | ||
} | ||
|
||
fragment multipleClientEdges_worst_enemy_resolver on User { | ||
actor_key | ||
} | ||
|
||
query multipleClientEdgesQuery { | ||
me { | ||
best_friend { | ||
name | ||
} | ||
worst_enemy { | ||
name | ||
} | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
name: String | ||
} | ||
|
||
extend type User { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "multipleClientEdges_best_friend_resolver" | ||
import_path: "./foo/bar/baz/BestFriendResolver.js" | ||
) | ||
} | ||
|
||
extend type User { | ||
worst_enemy: ClientUser | ||
@relay_resolver( | ||
fragment_name: "multipleClientEdges_worst_enemy_resolver" | ||
import_path: "./foo/bar/baz/WorstEnemyResolver.js" | ||
) | ||
} | ||
|
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