@mearie/solid 0.3.4 → 0.3.5
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/dist/index.cjs +7 -4
- package/dist/index.mjs +7 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -25,10 +25,13 @@ const createQuery = ((query, variables, options) => {
|
|
|
25
25
|
const [metadata, setMetadata] = (0, solid_js.createSignal)();
|
|
26
26
|
let unsubscribe = null;
|
|
27
27
|
let initialized = false;
|
|
28
|
-
const execute = () => {
|
|
28
|
+
const execute = (force = false) => {
|
|
29
29
|
unsubscribe?.();
|
|
30
|
-
if (options?.()?.skip)
|
|
31
|
-
|
|
30
|
+
if (!force && options?.()?.skip) {
|
|
31
|
+
setLoading(false);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (initialized || !initialOpts?.initialData) setLoading(true);
|
|
32
35
|
initialized = true;
|
|
33
36
|
setError(void 0);
|
|
34
37
|
unsubscribe = (0, _mearie_core_stream.pipe)(client.executeQuery(query, typeof variables === "function" ? variables() : variables, options?.()), (0, _mearie_core_stream.subscribe)({ next: (result) => {
|
|
@@ -44,7 +47,7 @@ const createQuery = ((query, variables, options) => {
|
|
|
44
47
|
} }));
|
|
45
48
|
};
|
|
46
49
|
const refetch = () => {
|
|
47
|
-
(0, solid_js.untrack)(execute);
|
|
50
|
+
(0, solid_js.untrack)(() => execute(true));
|
|
48
51
|
};
|
|
49
52
|
(0, solid_js.createEffect)(() => {
|
|
50
53
|
execute();
|
package/dist/index.mjs
CHANGED
|
@@ -26,10 +26,13 @@ const createQuery = ((query, variables, options) => {
|
|
|
26
26
|
const [metadata, setMetadata] = createSignal();
|
|
27
27
|
let unsubscribe = null;
|
|
28
28
|
let initialized = false;
|
|
29
|
-
const execute = () => {
|
|
29
|
+
const execute = (force = false) => {
|
|
30
30
|
unsubscribe?.();
|
|
31
|
-
if (options?.()?.skip)
|
|
32
|
-
|
|
31
|
+
if (!force && options?.()?.skip) {
|
|
32
|
+
setLoading(false);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (initialized || !initialOpts?.initialData) setLoading(true);
|
|
33
36
|
initialized = true;
|
|
34
37
|
setError(void 0);
|
|
35
38
|
unsubscribe = pipe(client.executeQuery(query, typeof variables === "function" ? variables() : variables, options?.()), subscribe({ next: (result) => {
|
|
@@ -45,7 +48,7 @@ const createQuery = ((query, variables, options) => {
|
|
|
45
48
|
} }));
|
|
46
49
|
};
|
|
47
50
|
const refetch = () => {
|
|
48
|
-
untrack(execute);
|
|
51
|
+
untrack(() => execute(true));
|
|
49
52
|
};
|
|
50
53
|
createEffect(() => {
|
|
51
54
|
execute();
|