houdini 1.0.0-next.3 → 1.0.0-next.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/build/cmd-cjs/index.js +39 -43
  2. package/build/cmd-esm/index.js +39 -43
  3. package/build/codegen/generators/artifacts/selection.d.ts +3 -3
  4. package/build/codegen-cjs/index.js +37 -41
  5. package/build/codegen-esm/index.js +37 -41
  6. package/build/runtime/cache/cache.d.ts +3 -3
  7. package/build/runtime/client/documentStore.d.ts +1 -1
  8. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  9. package/build/runtime/lib/types.d.ts +2 -3
  10. package/build/runtime-cjs/cache/cache.d.ts +3 -3
  11. package/build/runtime-cjs/cache/cache.js +30 -15
  12. package/build/runtime-cjs/cache/lists.js +3 -3
  13. package/build/runtime-cjs/client/documentStore.d.ts +1 -1
  14. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  15. package/build/runtime-cjs/client/plugins/fetchParams.js +6 -1
  16. package/build/runtime-cjs/client/plugins/query.js +0 -1
  17. package/build/runtime-cjs/lib/types.d.ts +2 -3
  18. package/build/runtime-esm/cache/cache.d.ts +3 -3
  19. package/build/runtime-esm/cache/cache.js +30 -15
  20. package/build/runtime-esm/cache/lists.js +3 -3
  21. package/build/runtime-esm/client/documentStore.d.ts +1 -1
  22. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  23. package/build/runtime-esm/client/plugins/fetchParams.js +6 -1
  24. package/build/runtime-esm/client/plugins/query.js +0 -1
  25. package/build/runtime-esm/lib/types.d.ts +2 -3
  26. package/build/test-cjs/index.js +37 -41
  27. package/build/test-esm/index.js +37 -41
  28. package/build/vite-cjs/index.js +37 -41
  29. package/build/vite-esm/index.js +37 -41
  30. package/package.json +1 -1
@@ -18,7 +18,7 @@ export declare class Cache {
18
18
  variables?: {};
19
19
  parent?: string;
20
20
  layer?: LayerID | null;
21
- applyUpdates?: boolean;
21
+ applyUpdates?: string[];
22
22
  notifySubscribers?: SubscriptionSpec[];
23
23
  forceNotify?: boolean;
24
24
  }): SubscriptionSpec[];
@@ -62,7 +62,7 @@ declare class CacheInternal {
62
62
  root?: string;
63
63
  layer: Layer;
64
64
  toNotify?: FieldSelection[];
65
- applyUpdates?: boolean;
65
+ applyUpdates?: string[];
66
66
  forceNotify?: boolean;
67
67
  }): FieldSelection[];
68
68
  getSelection({ selection, parent, variables, stepsFromConnection, }: {
@@ -97,7 +97,7 @@ declare class CacheInternal {
97
97
  abstract: boolean;
98
98
  variables: {};
99
99
  specs: FieldSelection[];
100
- applyUpdates: boolean;
100
+ applyUpdates?: string[];
101
101
  fields: SubscriptionSelection;
102
102
  layer: Layer;
103
103
  forceNotify?: boolean;
@@ -157,7 +157,7 @@ class CacheInternal {
157
157
  selection,
158
158
  variables = {},
159
159
  parent = rootID,
160
- applyUpdates = false,
160
+ applyUpdates,
161
161
  layer,
162
162
  toNotify = [],
163
163
  forceNotify
@@ -178,7 +178,7 @@ class CacheInternal {
178
178
  selection: fieldSelection,
179
179
  operations,
180
180
  abstract: isAbstract,
181
- update,
181
+ updates,
182
182
  nullable
183
183
  } = targetSelection[field];
184
184
  const key = (0, import_stuff.evaluateKey)(keyRaw, variables);
@@ -198,13 +198,23 @@ class CacheInternal {
198
198
  }
199
199
  if (!fieldSelection) {
200
200
  let newValue = value;
201
- if (Array.isArray(value) && applyUpdates && update) {
202
- if (update === "append") {
203
- newValue = (previousValue || []).concat(value);
204
- } else if (update === "prepend") {
205
- newValue = value.concat(previousValue || []);
201
+ if (updates && applyUpdates && Array.isArray(value)) {
202
+ for (const update of applyUpdates) {
203
+ if (!updates.includes(update)) {
204
+ continue;
205
+ }
206
+ if (update === "append") {
207
+ newValue = (previousValue || []).concat(value);
208
+ } else if (update === "prepend") {
209
+ newValue = value.concat(previousValue || []);
210
+ }
206
211
  }
207
212
  }
213
+ if (updates && applyUpdates?.includes("prepend") && ["endCursor", "hasNextPage"].includes(key)) {
214
+ newValue = previousValue;
215
+ } else if (updates && applyUpdates?.includes("append") && ["startCursor", "hasPreviousPage"].includes(key)) {
216
+ newValue = previousValue;
217
+ }
208
218
  const valueChanged = !(0, import_deepEquals.deepEquals)(newValue, previousValue);
209
219
  if (displayLayer && (valueChanged || forceNotify)) {
210
220
  toNotify.push(...currentSubscribers);
@@ -264,7 +274,7 @@ class CacheInternal {
264
274
  }
265
275
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
266
276
  let oldIDs = [...previousValue || []];
267
- const emptyEdges = !update ? [] : oldIDs.map((id) => {
277
+ const emptyEdges = !updates ? [] : oldIDs.map((id) => {
268
278
  if (!id) {
269
279
  return "";
270
280
  }
@@ -292,7 +302,7 @@ class CacheInternal {
292
302
  layer,
293
303
  forceNotify
294
304
  });
295
- if (applyUpdates && update) {
305
+ if (applyUpdates && updates) {
296
306
  if (key === "edges") {
297
307
  const newNodeIDs = [];
298
308
  for (const id of newIDs) {
@@ -320,12 +330,17 @@ class CacheInternal {
320
330
  return true;
321
331
  });
322
332
  }
323
- if (update === "prepend") {
324
- linkedIDs = newIDs.concat(oldIDs);
325
- } else if (update === "append") {
326
- linkedIDs = oldIDs.concat(newIDs);
327
- } else if (update === "replace") {
328
- linkedIDs = newIDs;
333
+ for (const update of applyUpdates) {
334
+ if (update !== "replace" && !updates.includes(update)) {
335
+ continue;
336
+ }
337
+ if (update === "prepend") {
338
+ linkedIDs = newIDs.concat(oldIDs);
339
+ } else if (update === "append") {
340
+ linkedIDs = oldIDs.concat(newIDs);
341
+ } else if (update === "replace") {
342
+ linkedIDs = newIDs;
343
+ }
329
344
  }
330
345
  } else {
331
346
  linkedIDs = nestedIDs;
@@ -176,7 +176,7 @@ class List {
176
176
  edges: {
177
177
  keyRaw: "edges",
178
178
  type: "ConnectionEdge",
179
- update: where === "first" ? "prepend" : "append",
179
+ updates: ["append", "prepend"],
180
180
  selection: {
181
181
  fields: {
182
182
  node: {
@@ -212,7 +212,7 @@ class List {
212
212
  newEntries: {
213
213
  keyRaw: this.key,
214
214
  type: listType,
215
- update: where === "first" ? "prepend" : "append",
215
+ updates: ["append", "prepend"],
216
216
  selection: {
217
217
  ...selection,
218
218
  fields: {
@@ -235,7 +235,7 @@ class List {
235
235
  data: insertData,
236
236
  variables,
237
237
  parent: this.recordID,
238
- applyUpdates: true
238
+ applyUpdates: [where === "first" ? "prepend" : "append"]
239
239
  });
240
240
  }
241
241
  removeID(id, variables = {}) {
@@ -53,7 +53,7 @@ export type ClientPluginContext = {
53
53
  forceNotify?: boolean;
54
54
  disableWrite?: boolean;
55
55
  disableRead?: boolean;
56
- applyUpdates?: boolean;
56
+ applyUpdates?: string[];
57
57
  };
58
58
  stuff: App.Stuff;
59
59
  };
@@ -5,5 +5,5 @@ export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
5
5
  export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
6
6
  text: string;
7
7
  hash: string;
8
- artifact: DocumentArtifact;
8
+ document: DocumentArtifact;
9
9
  };
@@ -26,7 +26,12 @@ const fetchParamsPlugin = (fn = () => ({})) => () => ({
26
26
  next({
27
27
  ...ctx,
28
28
  fetchParams: fn({
29
- ...ctx,
29
+ config: ctx.config,
30
+ policy: ctx.policy,
31
+ metadata: ctx.metadata,
32
+ session: ctx.session,
33
+ stuff: ctx.stuff,
34
+ document: ctx.artifact,
30
35
  variables: marshalVariables(ctx),
31
36
  text: ctx.artifact.raw,
32
37
  hash: ctx.artifact.hash
@@ -54,7 +54,6 @@ const queryPlugin = (0, import_utils.documentPlugin)(import_types.ArtifactKind.Q
54
54
  selection: ctx.artifact.selection,
55
55
  variables: () => lastVariables,
56
56
  set: (newValue) => {
57
- console.log("setting from cache update");
58
57
  resolve(ctx, {
59
58
  data: newValue,
60
59
  errors: null,
@@ -71,7 +71,6 @@ export type BaseCompiledDocument = {
71
71
  rootType: string;
72
72
  input?: InputObject;
73
73
  refetch?: {
74
- update: RefetchUpdateMode;
75
74
  path: string[];
76
75
  method: 'cursor' | 'offset';
77
76
  pageSize: number;
@@ -79,7 +78,7 @@ export type BaseCompiledDocument = {
79
78
  embedded: boolean;
80
79
  targetType: string;
81
80
  paginated: boolean;
82
- direction?: 'forward' | 'backwards';
81
+ direction: 'forward' | 'backward' | 'both';
83
82
  };
84
83
  pluginsData?: Record<string, any>;
85
84
  };
@@ -135,7 +134,7 @@ export type SubscriptionSelection = {
135
134
  connection: boolean;
136
135
  type: string;
137
136
  };
138
- update?: RefetchUpdateMode;
137
+ updates?: string[];
139
138
  filters?: {
140
139
  [key: string]: {
141
140
  kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
@@ -18,7 +18,7 @@ export declare class Cache {
18
18
  variables?: {};
19
19
  parent?: string;
20
20
  layer?: LayerID | null;
21
- applyUpdates?: boolean;
21
+ applyUpdates?: string[];
22
22
  notifySubscribers?: SubscriptionSpec[];
23
23
  forceNotify?: boolean;
24
24
  }): SubscriptionSpec[];
@@ -62,7 +62,7 @@ declare class CacheInternal {
62
62
  root?: string;
63
63
  layer: Layer;
64
64
  toNotify?: FieldSelection[];
65
- applyUpdates?: boolean;
65
+ applyUpdates?: string[];
66
66
  forceNotify?: boolean;
67
67
  }): FieldSelection[];
68
68
  getSelection({ selection, parent, variables, stepsFromConnection, }: {
@@ -97,7 +97,7 @@ declare class CacheInternal {
97
97
  abstract: boolean;
98
98
  variables: {};
99
99
  specs: FieldSelection[];
100
- applyUpdates: boolean;
100
+ applyUpdates?: string[];
101
101
  fields: SubscriptionSelection;
102
102
  layer: Layer;
103
103
  forceNotify?: boolean;
@@ -133,7 +133,7 @@ class CacheInternal {
133
133
  selection,
134
134
  variables = {},
135
135
  parent = rootID,
136
- applyUpdates = false,
136
+ applyUpdates,
137
137
  layer,
138
138
  toNotify = [],
139
139
  forceNotify
@@ -154,7 +154,7 @@ class CacheInternal {
154
154
  selection: fieldSelection,
155
155
  operations,
156
156
  abstract: isAbstract,
157
- update,
157
+ updates,
158
158
  nullable
159
159
  } = targetSelection[field];
160
160
  const key = evaluateKey(keyRaw, variables);
@@ -174,13 +174,23 @@ class CacheInternal {
174
174
  }
175
175
  if (!fieldSelection) {
176
176
  let newValue = value;
177
- if (Array.isArray(value) && applyUpdates && update) {
178
- if (update === "append") {
179
- newValue = (previousValue || []).concat(value);
180
- } else if (update === "prepend") {
181
- newValue = value.concat(previousValue || []);
177
+ if (updates && applyUpdates && Array.isArray(value)) {
178
+ for (const update of applyUpdates) {
179
+ if (!updates.includes(update)) {
180
+ continue;
181
+ }
182
+ if (update === "append") {
183
+ newValue = (previousValue || []).concat(value);
184
+ } else if (update === "prepend") {
185
+ newValue = value.concat(previousValue || []);
186
+ }
182
187
  }
183
188
  }
189
+ if (updates && applyUpdates?.includes("prepend") && ["endCursor", "hasNextPage"].includes(key)) {
190
+ newValue = previousValue;
191
+ } else if (updates && applyUpdates?.includes("append") && ["startCursor", "hasPreviousPage"].includes(key)) {
192
+ newValue = previousValue;
193
+ }
184
194
  const valueChanged = !deepEquals(newValue, previousValue);
185
195
  if (displayLayer && (valueChanged || forceNotify)) {
186
196
  toNotify.push(...currentSubscribers);
@@ -240,7 +250,7 @@ class CacheInternal {
240
250
  }
241
251
  } else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
242
252
  let oldIDs = [...previousValue || []];
243
- const emptyEdges = !update ? [] : oldIDs.map((id) => {
253
+ const emptyEdges = !updates ? [] : oldIDs.map((id) => {
244
254
  if (!id) {
245
255
  return "";
246
256
  }
@@ -268,7 +278,7 @@ class CacheInternal {
268
278
  layer,
269
279
  forceNotify
270
280
  });
271
- if (applyUpdates && update) {
281
+ if (applyUpdates && updates) {
272
282
  if (key === "edges") {
273
283
  const newNodeIDs = [];
274
284
  for (const id of newIDs) {
@@ -296,12 +306,17 @@ class CacheInternal {
296
306
  return true;
297
307
  });
298
308
  }
299
- if (update === "prepend") {
300
- linkedIDs = newIDs.concat(oldIDs);
301
- } else if (update === "append") {
302
- linkedIDs = oldIDs.concat(newIDs);
303
- } else if (update === "replace") {
304
- linkedIDs = newIDs;
309
+ for (const update of applyUpdates) {
310
+ if (update !== "replace" && !updates.includes(update)) {
311
+ continue;
312
+ }
313
+ if (update === "prepend") {
314
+ linkedIDs = newIDs.concat(oldIDs);
315
+ } else if (update === "append") {
316
+ linkedIDs = oldIDs.concat(newIDs);
317
+ } else if (update === "replace") {
318
+ linkedIDs = newIDs;
319
+ }
305
320
  }
306
321
  } else {
307
322
  linkedIDs = nestedIDs;
@@ -151,7 +151,7 @@ class List {
151
151
  edges: {
152
152
  keyRaw: "edges",
153
153
  type: "ConnectionEdge",
154
- update: where === "first" ? "prepend" : "append",
154
+ updates: ["append", "prepend"],
155
155
  selection: {
156
156
  fields: {
157
157
  node: {
@@ -187,7 +187,7 @@ class List {
187
187
  newEntries: {
188
188
  keyRaw: this.key,
189
189
  type: listType,
190
- update: where === "first" ? "prepend" : "append",
190
+ updates: ["append", "prepend"],
191
191
  selection: {
192
192
  ...selection,
193
193
  fields: {
@@ -210,7 +210,7 @@ class List {
210
210
  data: insertData,
211
211
  variables,
212
212
  parent: this.recordID,
213
- applyUpdates: true
213
+ applyUpdates: [where === "first" ? "prepend" : "append"]
214
214
  });
215
215
  }
216
216
  removeID(id, variables = {}) {
@@ -53,7 +53,7 @@ export type ClientPluginContext = {
53
53
  forceNotify?: boolean;
54
54
  disableWrite?: boolean;
55
55
  disableRead?: boolean;
56
- applyUpdates?: boolean;
56
+ applyUpdates?: string[];
57
57
  };
58
58
  stuff: App.Stuff;
59
59
  };
@@ -5,5 +5,5 @@ export declare const fetchParamsPlugin: (fn?: FetchParamFn) => ClientPlugin;
5
5
  export type FetchParamsInput = Pick<ClientPluginContext, 'config' | 'policy' | 'variables' | 'metadata' | 'session' | 'stuff'> & {
6
6
  text: string;
7
7
  hash: string;
8
- artifact: DocumentArtifact;
8
+ document: DocumentArtifact;
9
9
  };
@@ -3,7 +3,12 @@ const fetchParamsPlugin = (fn = () => ({})) => () => ({
3
3
  next({
4
4
  ...ctx,
5
5
  fetchParams: fn({
6
- ...ctx,
6
+ config: ctx.config,
7
+ policy: ctx.policy,
8
+ metadata: ctx.metadata,
9
+ session: ctx.session,
10
+ stuff: ctx.stuff,
11
+ document: ctx.artifact,
7
12
  variables: marshalVariables(ctx),
8
13
  text: ctx.artifact.raw,
9
14
  hash: ctx.artifact.hash
@@ -25,7 +25,6 @@ const queryPlugin = documentPlugin(ArtifactKind.Query, function() {
25
25
  selection: ctx.artifact.selection,
26
26
  variables: () => lastVariables,
27
27
  set: (newValue) => {
28
- console.log("setting from cache update");
29
28
  resolve(ctx, {
30
29
  data: newValue,
31
30
  errors: null,
@@ -71,7 +71,6 @@ export type BaseCompiledDocument = {
71
71
  rootType: string;
72
72
  input?: InputObject;
73
73
  refetch?: {
74
- update: RefetchUpdateMode;
75
74
  path: string[];
76
75
  method: 'cursor' | 'offset';
77
76
  pageSize: number;
@@ -79,7 +78,7 @@ export type BaseCompiledDocument = {
79
78
  embedded: boolean;
80
79
  targetType: string;
81
80
  paginated: boolean;
82
- direction?: 'forward' | 'backwards';
81
+ direction: 'forward' | 'backward' | 'both';
83
82
  };
84
83
  pluginsData?: Record<string, any>;
85
84
  };
@@ -135,7 +134,7 @@ export type SubscriptionSelection = {
135
134
  connection: boolean;
136
135
  type: string;
137
136
  };
138
- update?: RefetchUpdateMode;
137
+ updates?: string[];
139
138
  filters?: {
140
139
  [key: string]: {
141
140
  kind: 'Boolean' | 'String' | 'Float' | 'Int' | 'Variable';
@@ -56029,19 +56029,18 @@ async function paginate(config2, documents) {
56029
56029
  paginated = true;
56030
56030
  const fieldTypeFields = parentTypeFromAncestors(config2.schema, doc.filename, ancestors).getFields()[node.name.value];
56031
56031
  const args = new Set(fieldTypeFields.args.map((arg) => arg.name));
56032
- const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
56033
- const specifiedForwards = passedArgs.has("first");
56034
- const specifiedBackwards = passedArgs.has("last");
56035
56032
  cursorType = fieldTypeFields.args?.find((arg) => ["before", "after"].includes(arg.name))?.type?.name || "String";
56036
56033
  flags.after.type = cursorType;
56037
56034
  flags.before.type = cursorType;
56038
- const forwardPagination = !specifiedBackwards && args.has("first") && args.has("after");
56039
- const backwardsPagination = !specifiedForwards && args.has("last") && args.has("before");
56040
- const offsetPagination = !forwardPagination && !backwardsPagination && args.has("offset") && args.has("limit");
56041
- flags.first.enabled = forwardPagination;
56042
- flags.after.enabled = forwardPagination;
56043
- flags.last.enabled = backwardsPagination;
56044
- flags.before.enabled = backwardsPagination;
56035
+ const passedArgs = new Set(node.arguments?.map((arg) => arg.name.value));
56036
+ const forwards = args.has("first") && args.has("after");
56037
+ const backwards = args.has("last") && args.has("after");
56038
+ const cursorPagination = passedArgs.has("last") || passedArgs.has("first");
56039
+ const offsetPagination = !cursorPagination && args.has("offset") && args.has("limit");
56040
+ flags.first.enabled = forwards;
56041
+ flags.after.enabled = forwards;
56042
+ flags.last.enabled = backwards;
56043
+ flags.before.enabled = backwards;
56045
56044
  flags.offset.enabled = offsetPagination;
56046
56045
  flags.limit.enabled = offsetPagination;
56047
56046
  paginationPath = ancestors.filter(
@@ -56061,10 +56060,6 @@ async function paginate(config2, documents) {
56061
56060
  let fragmentName = "";
56062
56061
  let refetchQueryName = "";
56063
56062
  let nodeQuery = false;
56064
- let refetchUpdate = "append" /* append */;
56065
- if (flags.last.enabled) {
56066
- refetchUpdate = "prepend" /* prepend */;
56067
- }
56068
56063
  let fragment = "";
56069
56064
  doc.document = graphql8.visit(doc.document, {
56070
56065
  OperationDefinition(node) {
@@ -56159,26 +56154,24 @@ async function paginate(config2, documents) {
56159
56154
  targetType = fragment;
56160
56155
  }
56161
56156
  }
56157
+ const pageSize = flags.first.defaultValue ?? flags.last.defaultValue ?? flags.limit.defaultValue;
56158
+ const start = flags.after.defaultValue ?? flags.before.defaultValue ?? flags.offset.defaultValue;
56159
+ let direction = "forward";
56160
+ if (flags.before.enabled && flags.after.enabled) {
56161
+ direction = "both";
56162
+ } else if (flags.before.enabled) {
56163
+ direction = "backward";
56164
+ }
56162
56165
  doc.refetch = {
56163
- update: refetchUpdate,
56164
56166
  path: paginationPath,
56165
56167
  method: flags.first.enabled || flags.last.enabled ? "cursor" : "offset",
56166
- pageSize: 0,
56168
+ pageSize,
56167
56169
  embedded: nodeQuery,
56168
56170
  targetType,
56169
56171
  paginated: true,
56170
- direction: flags.last.enabled ? "backwards" : "forward"
56171
- };
56172
- if (flags.first.enabled) {
56173
- doc.refetch.pageSize = flags.first.defaultValue;
56174
- doc.refetch.start = flags.after.defaultValue;
56175
- } else if (flags.last.enabled) {
56176
- doc.refetch.pageSize = flags.last.defaultValue;
56177
- doc.refetch.start = flags.before.defaultValue;
56178
- } else if (flags.limit.enabled) {
56179
- doc.refetch.pageSize = flags.limit.defaultValue;
56180
- doc.refetch.start = flags.offset.defaultValue;
56181
- }
56172
+ direction,
56173
+ start
56174
+ };
56182
56175
  if (!fragment) {
56183
56176
  continue;
56184
56177
  }
@@ -56354,12 +56347,6 @@ function replaceArgumentsWithVariables(args, flags) {
56354
56347
  if (flags[name2].defaultValue || !spec.enabled || seenArgs[name2]) {
56355
56348
  continue;
56356
56349
  }
56357
- if (["first", "after"].includes(name2) && flags["before"].enabled) {
56358
- continue;
56359
- }
56360
- if (["last", "before"].includes(name2) && flags["first"].enabled) {
56361
- continue;
56362
- }
56363
56350
  newArgs.push(variableAsArgument(name2));
56364
56351
  }
56365
56352
  return newArgs;
@@ -56867,7 +56854,7 @@ function selection({
56867
56854
  path: path2 = [],
56868
56855
  includeFragments,
56869
56856
  document,
56870
- markEdges
56857
+ inConnection
56871
56858
  }) {
56872
56859
  let object = {};
56873
56860
  const typeMap = {};
@@ -57009,14 +56996,23 @@ function selection({
57009
56996
  (directive) => directive.name.value === config2.paginateDirective
57010
56997
  );
57011
56998
  if (paginated && document.refetch && document.refetch.method === "offset") {
57012
- fieldObj.update = document.refetch.update;
56999
+ fieldObj.updates = ["append" /* append */];
57000
+ }
57001
+ let continueConnection = inConnection;
57002
+ if ([
57003
+ "edges",
57004
+ "endCursor",
57005
+ "startCursor",
57006
+ "hasNextPage",
57007
+ "hasPreviousPage"
57008
+ ].includes(attributeName) && inConnection && document.refetch) {
57009
+ fieldObj.updates = ["append" /* append */, "prepend" /* prepend */];
57013
57010
  }
57014
- if (attributeName === "edges" && markEdges && document.refetch) {
57015
- fieldObj.update = document.refetch.update;
57016
- markEdges = "";
57011
+ if (attributeName === "node" && inConnection) {
57012
+ continueConnection = false;
57017
57013
  }
57018
57014
  if (field.selectionSet) {
57019
- const edgesMark = paginated && document.refetch?.method === "cursor" ? document.refetch.update : markEdges;
57015
+ const connectionState = paginated && document.refetch?.method === "cursor" || continueConnection;
57020
57016
  fieldObj.selection = selection({
57021
57017
  config: config2,
57022
57018
  filepath,
@@ -57026,7 +57022,7 @@ function selection({
57026
57022
  path: pathSoFar,
57027
57023
  includeFragments,
57028
57024
  document,
57029
- markEdges: edgesMark
57025
+ inConnection: connectionState
57030
57026
  });
57031
57027
  }
57032
57028
  if (field.arguments?.length && fieldObj.list) {