Skip to content

Commit ea3a5f7

Browse files
committed
Pass variables
1 parent 11a1172 commit ea3a5f7

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

examples/yoga/persisted/MyQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,6 @@ const doc: DocumentNode = {
103103
}
104104
]
105105
} as DocumentNode;
106-
export function executeOperation() {
107-
return execute({ schema: schema, document: doc });
106+
export function executeOperation(variables: any) {
107+
return execute({ schema: schema, document: doc, variableValues: variables });
108108
}

src/queryCodegen.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,16 @@ class QueryCodegen {
8787
undefined,
8888
"executeOperation",
8989
undefined,
90-
[],
90+
[
91+
F.createParameterDeclaration(
92+
undefined,
93+
undefined,
94+
"variables",
95+
undefined,
96+
F.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword),
97+
undefined,
98+
),
99+
],
91100
undefined,
92101
F.createBlock(
93102
[
@@ -102,6 +111,10 @@ class QueryCodegen {
102111
"document",
103112
F.createIdentifier("doc"),
104113
),
114+
F.createPropertyAssignment(
115+
"variableValues",
116+
F.createIdentifier("variables"),
117+
),
105118
]),
106119
]),
107120
),

0 commit comments

Comments
 (0)