Skip to content

Commit

Permalink
remove type condition from @defer fragments
Browse files Browse the repository at this point in the history
Reviewed By: alunyov

Differential Revision: D21759948

fbshipit-source-id: aeaed13d67a2be2080ea7ae88270b55418e968fb
  • Loading branch information
kassens authored and facebook-github-bot committed May 28, 2020
1 parent bc09a8e commit 23300a9
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17581,7 +17581,7 @@ fragment PaginationFragment_1G22uz on Node {
}
cursor
}
... on FriendsConnection @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
... @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
pageInfo {
endCursor
hasNextPage
Expand Down Expand Up @@ -18348,7 +18348,7 @@ fragment PaginationFragment on Node {
}
cursor
}
... on FriendsConnection @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
... @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
pageInfo {
endCursor
hasNextPage
Expand Down Expand Up @@ -19704,7 +19704,7 @@ query NodeQuery(
}
cursor
}
... on CommentsConnection @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
... @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
pageInfo {
endCursor
hasNextPage
Expand Down
3 changes: 0 additions & 3 deletions packages/relay-compiler/core/IR.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ export type FragmentSpread = {|
export type Defer = {|
+kind: 'Defer',
+loc: Location,
+metadata: ?{|
+fragmentTypeCondition: CompositeTypeID,
|},
+selections: $ReadOnlyArray<Selection>,
+label: string,
+if: ArgumentValue | null,
Expand Down
12 changes: 1 addition & 11 deletions packages/relay-compiler/core/IRPrinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,7 @@ function printSelection(
);
str = subSelections.join('\n' + INDENT);
} else {
if (
selection.metadata != null &&
selection.metadata.fragmentTypeCondition != null
) {
str =
`... on ${schema.getTypeString(
selection.metadata.fragmentTypeCondition,
)}` + deferStr;
} else {
str = '...' + deferStr;
}
str = '...' + deferStr;
str += printSelections(schema, selection, indent + INDENT, {
isClientExtension,
});
Expand Down
3 changes: 0 additions & 3 deletions packages/relay-compiler/transforms/ConnectionTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,9 +605,6 @@ function transformConnectionSelections(
label: `${documentName}$defer$${stream.label}$${PAGE_INFO}`,
kind: 'Defer',
loc: derivedFieldLocation,
metadata: {
fragmentTypeCondition: nullableType,
},
selections: [transformedPageInfoSelection],
};
}
Expand Down
1 change: 0 additions & 1 deletion packages/relay-compiler/transforms/DeferStreamTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ function visitFragmentSpread(
kind: 'Defer',
label: transformedLabel,
loc: {kind: 'Derived', source: deferDirective.loc},
metadata: null,
selections: [transformedSpread],
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ query NodeQuery(
}
}
}
... on CommentsConnection @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
... @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
pageInfo {
endCursor
hasNextPage
Expand Down Expand Up @@ -1106,7 +1106,7 @@ query NodeQuery(
}
}
}
... on CommentsConnection @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
... @defer(label: "NodeQuery$defer$NodeQuery_comments$pageInfo") {
pageInfo {
endCursor
hasNextPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ fragment PaginationFragment on Node @argumentDefinitions(
}
}
}
... on FriendsConnection @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
... @defer(label: "PaginationFragment$defer$PaginationFragment_friends$pageInfo") {
pageInfo {
... on PageInfo {
endCursor
Expand Down

0 comments on commit 23300a9

Please sign in to comment.