houdini-svelte 1.0.0-next.16 → 1.0.0-next.18
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.
|
@@ -45,11 +45,11 @@ class QueryStore extends import_base.BaseStore {
|
|
|
45
45
|
#store;
|
|
46
46
|
#unsubscribe = null;
|
|
47
47
|
constructor({ artifact, storeName, variables }) {
|
|
48
|
-
const fetching = artifact.
|
|
48
|
+
const fetching = artifact.pluginData?.["houdini-svelte"].isManualLoad !== true;
|
|
49
49
|
super({ artifact, fetching });
|
|
50
50
|
this.storeName = storeName;
|
|
51
51
|
this.variables = variables;
|
|
52
|
-
this.#store = new import_client.DocumentStore({ artifact, client: null });
|
|
52
|
+
this.#store = new import_client.DocumentStore({ artifact, client: null, fetching });
|
|
53
53
|
}
|
|
54
54
|
async fetch(args) {
|
|
55
55
|
await (0, import_client2.initClient)();
|
|
@@ -105,18 +105,26 @@ This will result in duplicate queries. If you are trying to ensure there is alwa
|
|
|
105
105
|
return this.artifact.name;
|
|
106
106
|
}
|
|
107
107
|
#setup(init = true) {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
let initPromise = Promise.resolve();
|
|
109
|
+
try {
|
|
110
|
+
(0, import_client2.getClient)();
|
|
111
|
+
} catch {
|
|
112
|
+
initPromise = (0, import_client2.initClient)();
|
|
110
113
|
}
|
|
111
|
-
|
|
112
|
-
this.#
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
variables: (0, import_store.get)(this.observer).variables
|
|
114
|
+
initPromise.then(() => {
|
|
115
|
+
if (this.#unsubscribe) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.#unsubscribe = this.observer.subscribe((value) => {
|
|
119
|
+
this.#store.set(value);
|
|
118
120
|
});
|
|
119
|
-
|
|
121
|
+
if (init) {
|
|
122
|
+
return this.observer.send({
|
|
123
|
+
setup: true,
|
|
124
|
+
variables: (0, import_store.get)(this.observer).variables
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
120
128
|
}
|
|
121
129
|
subscribe(...args) {
|
|
122
130
|
const bubbleUp = this.#store.subscribe(...args);
|
|
@@ -3,7 +3,7 @@ import * as log from "$houdini/runtime/lib/log";
|
|
|
3
3
|
import { ArtifactKind, CachePolicy, CompiledQueryKind } from "$houdini/runtime/lib/types";
|
|
4
4
|
import { get } from "svelte/store";
|
|
5
5
|
import { clientStarted, isBrowser } from "../adapter";
|
|
6
|
-
import { initClient } from "../client";
|
|
6
|
+
import { getClient, initClient } from "../client";
|
|
7
7
|
import { getSession } from "../session";
|
|
8
8
|
import { BaseStore } from "./base";
|
|
9
9
|
class QueryStore extends BaseStore {
|
|
@@ -15,11 +15,11 @@ class QueryStore extends BaseStore {
|
|
|
15
15
|
#store;
|
|
16
16
|
#unsubscribe = null;
|
|
17
17
|
constructor({ artifact, storeName, variables }) {
|
|
18
|
-
const fetching = artifact.
|
|
18
|
+
const fetching = artifact.pluginData?.["houdini-svelte"].isManualLoad !== true;
|
|
19
19
|
super({ artifact, fetching });
|
|
20
20
|
this.storeName = storeName;
|
|
21
21
|
this.variables = variables;
|
|
22
|
-
this.#store = new DocumentStore({ artifact, client: null });
|
|
22
|
+
this.#store = new DocumentStore({ artifact, client: null, fetching });
|
|
23
23
|
}
|
|
24
24
|
async fetch(args) {
|
|
25
25
|
await initClient();
|
|
@@ -75,18 +75,26 @@ This will result in duplicate queries. If you are trying to ensure there is alwa
|
|
|
75
75
|
return this.artifact.name;
|
|
76
76
|
}
|
|
77
77
|
#setup(init = true) {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
let initPromise = Promise.resolve();
|
|
79
|
+
try {
|
|
80
|
+
getClient();
|
|
81
|
+
} catch {
|
|
82
|
+
initPromise = initClient();
|
|
80
83
|
}
|
|
81
|
-
|
|
82
|
-
this.#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
variables: get(this.observer).variables
|
|
84
|
+
initPromise.then(() => {
|
|
85
|
+
if (this.#unsubscribe) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
this.#unsubscribe = this.observer.subscribe((value) => {
|
|
89
|
+
this.#store.set(value);
|
|
88
90
|
});
|
|
89
|
-
|
|
91
|
+
if (init) {
|
|
92
|
+
return this.observer.send({
|
|
93
|
+
setup: true,
|
|
94
|
+
variables: get(this.observer).variables
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
});
|
|
90
98
|
}
|
|
91
99
|
subscribe(...args) {
|
|
92
100
|
const bubbleUp = this.#store.subscribe(...args);
|
package/build/test-cjs/index.js
CHANGED
|
@@ -146817,7 +146817,7 @@ function artifactGenerator(stats) {
|
|
|
146817
146817
|
{}
|
|
146818
146818
|
);
|
|
146819
146819
|
if (Object.keys(plugin_data).length > 0) {
|
|
146820
|
-
artifact.
|
|
146820
|
+
artifact.pluginData = plugin_data;
|
|
146821
146821
|
}
|
|
146822
146822
|
if (inputs && inputs.length > 0) {
|
|
146823
146823
|
artifact.input = inputObject(config22, inputs);
|
package/build/test-esm/index.js
CHANGED
|
@@ -146808,7 +146808,7 @@ function artifactGenerator(stats) {
|
|
|
146808
146808
|
{}
|
|
146809
146809
|
);
|
|
146810
146810
|
if (Object.keys(plugin_data).length > 0) {
|
|
146811
|
-
artifact.
|
|
146811
|
+
artifact.pluginData = plugin_data;
|
|
146812
146812
|
}
|
|
146813
146813
|
if (inputs && inputs.length > 0) {
|
|
146814
146814
|
artifact.input = inputObject(config22, inputs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.18",
|
|
4
4
|
"description": "The svelte plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"rollup": "^3.7.4",
|
|
33
33
|
"svelte": "^3.55.1",
|
|
34
34
|
"vite": "^4.0.4",
|
|
35
|
-
"houdini": "^1.0.0-next.
|
|
35
|
+
"houdini": "^1.0.0-next.18"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"build"
|