houdini 0.13.2-alpha.2 → 0.13.2-alpha.3

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.
@@ -152,23 +152,29 @@ function query(document) {
152
152
  return __generator(this, function (_b) {
153
153
  switch (_b.label) {
154
154
  case 0:
155
- _b.trys.push([0, 2, , 3]);
155
+ loading.set(true);
156
+ _b.label = 1;
157
+ case 1:
158
+ _b.trys.push([1, 3, , 4]);
156
159
  variableBag = variables;
157
160
  // If new variables are set spread the new variables over the previous ones.
158
161
  if (newVariables) {
159
162
  variableBag = __assign(__assign({}, variableBag), newVariables);
160
163
  }
161
164
  return [4 /*yield*/, network_1.executeQuery(artifact, variableBag, sessionStore, false)];
162
- case 1:
165
+ case 2:
163
166
  _a = _b.sent(), result = _a.result, partialData = _a.partial;
164
167
  partial.set(partialData);
165
168
  // Write the data to the cache
166
169
  writeData(result, variableBag);
167
- return [3 /*break*/, 3];
168
- case 2:
170
+ return [3 /*break*/, 4];
171
+ case 3:
169
172
  error_1 = _b.sent();
170
173
  throw error_1;
171
- case 3: return [2 /*return*/];
174
+ case 4:
175
+ // track the loading state
176
+ loading.set(false);
177
+ return [2 /*return*/];
172
178
  }
173
179
  });
174
180
  });
@@ -152,23 +152,29 @@ function query(document) {
152
152
  return __generator(this, function (_b) {
153
153
  switch (_b.label) {
154
154
  case 0:
155
- _b.trys.push([0, 2, , 3]);
155
+ loading.set(true);
156
+ _b.label = 1;
157
+ case 1:
158
+ _b.trys.push([1, 3, , 4]);
156
159
  variableBag = variables;
157
160
  // If new variables are set spread the new variables over the previous ones.
158
161
  if (newVariables) {
159
162
  variableBag = __assign(__assign({}, variableBag), newVariables);
160
163
  }
161
164
  return [4 /*yield*/, network_1.executeQuery(artifact, variableBag, sessionStore, false)];
162
- case 1:
165
+ case 2:
163
166
  _a = _b.sent(), result = _a.result, partialData = _a.partial;
164
167
  partial.set(partialData);
165
168
  // Write the data to the cache
166
169
  writeData(result, variableBag);
167
- return [3 /*break*/, 3];
168
- case 2:
170
+ return [3 /*break*/, 4];
171
+ case 3:
169
172
  error_1 = _b.sent();
170
173
  throw error_1;
171
- case 3: return [2 /*return*/];
174
+ case 4:
175
+ // track the loading state
176
+ loading.set(false);
177
+ return [2 /*return*/];
172
178
  }
173
179
  });
174
180
  });
@@ -94,6 +94,7 @@ export function query(document) {
94
94
  data: { subscribe: store.subscribe },
95
95
  // the refetch function can be used to refetch queries possibly with new variables/arguments
96
96
  async refetch(newVariables) {
97
+ loading.set(true);
97
98
  try {
98
99
  // Use the initial/previous variables
99
100
  let variableBag = variables;
@@ -110,6 +111,8 @@ export function query(document) {
110
111
  catch (error) {
111
112
  throw error;
112
113
  }
114
+ // track the loading state
115
+ loading.set(false);
113
116
  },
114
117
  // used primarily by the preprocessor to keep local state in sync with
115
118
  // the data given by preload
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "0.13.2-alpha.2",
3
+ "version": "0.13.2-alpha.3",
4
4
  "description": "The disappearing graphql client for SvelteKit",
5
5
  "scripts": {
6
6
  "build:runtime": "npm run build:runtime:cjs && npm run build:runtime:esm",
@@ -57,5 +57,5 @@
57
57
  "rollup-plugin-preserve-shebangs": "^0.2.0",
58
58
  "svelte": "^3.34.0"
59
59
  },
60
- "gitHead": "7464d80179817fda2a0e7e3655b309152883be32"
60
+ "gitHead": "f528d92b3af2875d1c9178871d5ab35070c7de2b"
61
61
  }
package/runtime/query.ts CHANGED
@@ -131,6 +131,8 @@ export function query<_Query extends Operation<any, any>>(
131
131
  data: { subscribe: store.subscribe },
132
132
  // the refetch function can be used to refetch queries possibly with new variables/arguments
133
133
  async refetch(newVariables?: _Query['input']) {
134
+ loading.set(true)
135
+
134
136
  try {
135
137
  // Use the initial/previous variables
136
138
  let variableBag = variables
@@ -155,6 +157,9 @@ export function query<_Query extends Operation<any, any>>(
155
157
  } catch (error) {
156
158
  throw error
157
159
  }
160
+
161
+ // track the loading state
162
+ loading.set(false)
158
163
  },
159
164
  // used primarily by the preprocessor to keep local state in sync with
160
165
  // the data given by preload