houdini-react 1.2.38 → 1.2.40
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.
- package/build/plugin-cjs/index.js +2 -5
- package/build/plugin-esm/index.js +2 -5
- package/build/runtime/routing/Router.d.ts +1 -1
- package/build/runtime-cjs/routing/Router.d.ts +1 -1
- package/build/runtime-cjs/routing/Router.js +8 -2
- package/build/runtime-esm/routing/Router.d.ts +1 -1
- package/build/runtime-esm/routing/Router.js +8 -2
- package/package.json +2 -2
|
@@ -77360,10 +77360,7 @@ var CacheInternal = class {
|
|
|
77360
77360
|
});
|
|
77361
77361
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
77362
77362
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
77363
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
77364
|
-
if (typeof target !== "string") {
|
|
77365
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
77366
|
-
}
|
|
77363
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
77367
77364
|
const targetID = this.id(operation.type, target);
|
|
77368
77365
|
if (!targetID) {
|
|
77369
77366
|
continue;
|
|
@@ -77563,7 +77560,7 @@ var CacheInternal = class {
|
|
|
77563
77560
|
};
|
|
77564
77561
|
}
|
|
77565
77562
|
id(type, data) {
|
|
77566
|
-
const id = typeof data === "
|
|
77563
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
77567
77564
|
if (!id) {
|
|
77568
77565
|
return null;
|
|
77569
77566
|
}
|
|
@@ -77350,10 +77350,7 @@ var CacheInternal = class {
|
|
|
77350
77350
|
});
|
|
77351
77351
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
77352
77352
|
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
77353
|
-
} else if (operation.action === "delete" && operation.type) {
|
|
77354
|
-
if (typeof target !== "string") {
|
|
77355
|
-
throw new Error("Cannot delete a record with a non-string ID");
|
|
77356
|
-
}
|
|
77353
|
+
} else if (operation.action === "delete" && operation.type && target) {
|
|
77357
77354
|
const targetID = this.id(operation.type, target);
|
|
77358
77355
|
if (!targetID) {
|
|
77359
77356
|
continue;
|
|
@@ -77553,7 +77550,7 @@ var CacheInternal = class {
|
|
|
77553
77550
|
};
|
|
77554
77551
|
}
|
|
77555
77552
|
id(type, data) {
|
|
77556
|
-
const id = typeof data === "
|
|
77553
|
+
const id = typeof data === "object" ? this.computeID(type, data) : data;
|
|
77557
77554
|
if (!id) {
|
|
77558
77555
|
return null;
|
|
77559
77556
|
}
|
|
@@ -41,7 +41,7 @@ type RouterContext = {
|
|
|
41
41
|
};
|
|
42
42
|
export type PendingCache = SuspenseCache<Promise<void> & {
|
|
43
43
|
resolve: () => void;
|
|
44
|
-
reject: () => void;
|
|
44
|
+
reject: (message: string) => void;
|
|
45
45
|
}>;
|
|
46
46
|
export declare const useRouterContext: () => RouterContext;
|
|
47
47
|
export declare function useClient(): HoudiniClient;
|
|
@@ -41,7 +41,7 @@ type RouterContext = {
|
|
|
41
41
|
};
|
|
42
42
|
export type PendingCache = SuspenseCache<Promise<void> & {
|
|
43
43
|
resolve: () => void;
|
|
44
|
-
reject: () => void;
|
|
44
|
+
reject: (message: string) => void;
|
|
45
45
|
}>;
|
|
46
46
|
export declare const useRouterContext: () => RouterContext;
|
|
47
47
|
export declare function useClient(): HoudiniClient;
|
|
@@ -135,6 +135,10 @@ function usePageData({
|
|
|
135
135
|
session
|
|
136
136
|
}).then(() => {
|
|
137
137
|
data_cache.set(id, observer);
|
|
138
|
+
if (observer.state.errors && observer.state.errors.length > 0) {
|
|
139
|
+
reject(observer.state.errors.map((e) => e.message).join("\n"));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
138
142
|
injectToStream?.(`
|
|
139
143
|
<script>
|
|
140
144
|
{
|
|
@@ -201,7 +205,6 @@ function usePageData({
|
|
|
201
205
|
});
|
|
202
206
|
const resolvable = { ...promise, resolve, reject };
|
|
203
207
|
if (!globalThis.window) {
|
|
204
|
-
console.log("setting ssr signal");
|
|
205
208
|
ssr_signals.set(id, resolvable);
|
|
206
209
|
}
|
|
207
210
|
return resolvable;
|
|
@@ -335,10 +338,13 @@ function useCurrentVariables() {
|
|
|
335
338
|
const VariableContext = import_react.default.createContext(null);
|
|
336
339
|
function useQueryResult(name) {
|
|
337
340
|
const store_ref = useRouterContext().data_cache.get(name);
|
|
338
|
-
const [{ data }, observer] = (0, import_useDocumentStore.useDocumentStore)({
|
|
341
|
+
const [{ data, errors }, observer] = (0, import_useDocumentStore.useDocumentStore)({
|
|
339
342
|
artifact: store_ref.artifact,
|
|
340
343
|
observer: store_ref
|
|
341
344
|
});
|
|
345
|
+
if (errors && errors.length > 0) {
|
|
346
|
+
throw new Error(JSON.stringify(errors));
|
|
347
|
+
}
|
|
342
348
|
return [data, observer];
|
|
343
349
|
}
|
|
344
350
|
function useLinkBehavior({
|
|
@@ -41,7 +41,7 @@ type RouterContext = {
|
|
|
41
41
|
};
|
|
42
42
|
export type PendingCache = SuspenseCache<Promise<void> & {
|
|
43
43
|
resolve: () => void;
|
|
44
|
-
reject: () => void;
|
|
44
|
+
reject: (message: string) => void;
|
|
45
45
|
}>;
|
|
46
46
|
export declare const useRouterContext: () => RouterContext;
|
|
47
47
|
export declare function useClient(): HoudiniClient;
|
|
@@ -97,6 +97,10 @@ function usePageData({
|
|
|
97
97
|
session
|
|
98
98
|
}).then(() => {
|
|
99
99
|
data_cache.set(id, observer);
|
|
100
|
+
if (observer.state.errors && observer.state.errors.length > 0) {
|
|
101
|
+
reject(observer.state.errors.map((e) => e.message).join("\n"));
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
100
104
|
injectToStream?.(`
|
|
101
105
|
<script>
|
|
102
106
|
{
|
|
@@ -163,7 +167,6 @@ function usePageData({
|
|
|
163
167
|
});
|
|
164
168
|
const resolvable = { ...promise, resolve, reject };
|
|
165
169
|
if (!globalThis.window) {
|
|
166
|
-
console.log("setting ssr signal");
|
|
167
170
|
ssr_signals.set(id, resolvable);
|
|
168
171
|
}
|
|
169
172
|
return resolvable;
|
|
@@ -297,10 +300,13 @@ function useCurrentVariables() {
|
|
|
297
300
|
const VariableContext = React.createContext(null);
|
|
298
301
|
function useQueryResult(name) {
|
|
299
302
|
const store_ref = useRouterContext().data_cache.get(name);
|
|
300
|
-
const [{ data }, observer] = useDocumentStore({
|
|
303
|
+
const [{ data, errors }, observer] = useDocumentStore({
|
|
301
304
|
artifact: store_ref.artifact,
|
|
302
305
|
observer: store_ref
|
|
303
306
|
});
|
|
307
|
+
if (errors && errors.length > 0) {
|
|
308
|
+
throw new Error(JSON.stringify(errors));
|
|
309
|
+
}
|
|
304
310
|
return [data, observer];
|
|
305
311
|
}
|
|
306
312
|
function useLinkBehavior({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-react",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.40",
|
|
4
4
|
"description": "The React plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"recast": "^0.23.1",
|
|
44
44
|
"rollup": "^3.7.4",
|
|
45
45
|
"use-deep-compare-effect": "^1.8.1",
|
|
46
|
-
"houdini": "^1.2.
|
|
46
|
+
"houdini": "^1.2.40"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"build"
|