Skip to content

Commit

Permalink
diffRelayQuery: split plural roots with array calls
Browse files Browse the repository at this point in the history
Summary: Addreses #358 - ensures that when `diffRelayQuery` splits plural root calls into queries per value, that the root call values are arrays of a singular values instead of scalars. This ensures that the check in `RelayOSSNodeInterface` for matching root call / payload plurality passes.
Closes #361

Reviewed By: @steveluscher

Differential Revision: D2462359
  • Loading branch information
josephsavona authored and facebook-github-bot-9 committed Sep 22, 2015
1 parent f892796 commit be0111d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/traversal/__tests__/diffRelayQuery-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,11 +672,11 @@ describe('diffRelayQuery', () => {
expect(diffQueries.length).toBe(2);
expect(diffQueries[0].getName()).toBe(query.getName());
expect(diffQueries[0]).toEqualQueryRoot(getNode(
Relay.QL`query{nodes(ids:"4") {id, name}}`
Relay.QL`query{nodes(ids:["4"]) {id, name}}`
));
expect(diffQueries[1].getName()).toBe(query.getName());
expect(diffQueries[1]).toEqualQueryRoot(getNode(
Relay.QL`query{nodes(ids:"4808495") {id, name}}`
Relay.QL`query{nodes(ids:["4808495"]) {id, name}}`
));
});

Expand Down Expand Up @@ -1147,7 +1147,7 @@ describe('diffRelayQuery', () => {
`;
var expected0 = getNode(Relay.QL`
query {
nodes(ids:"4") {
nodes(ids:["4"]) {
id,
${firstNameFrag},
${expectedFragment},
Expand All @@ -1156,7 +1156,7 @@ describe('diffRelayQuery', () => {
`);
var expected1 = getNode(Relay.QL`
query {
nodes(ids:"4808495") {
nodes(ids:["4808495"]) {
id,
name,
${defer(firstNameFrag)},
Expand Down
2 changes: 1 addition & 1 deletion src/traversal/diffRelayQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function diffRelayQuery(
);
nodeRoot = RelayQuery.Root.build(
rootCallName,
rootCallArg,
[rootCallArg],
root.getChildren(),
{
rootArg: root.getRootCallArgument(),
Expand Down

0 comments on commit be0111d

Please sign in to comment.