@mearie/solid 0.3.3 → 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 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) return;
31
- if (!initialized && initialOpts?.initialData) setLoading(true);
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) return;
32
- if (!initialized && initialOpts?.initialData) setLoading(true);
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearie/solid",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Type-safe, zero-overhead GraphQL client",
5
5
  "keywords": [
6
6
  "graphql",
@@ -52,7 +52,7 @@
52
52
  "README.md"
53
53
  ],
54
54
  "dependencies": {
55
- "@mearie/core": "0.5.1"
55
+ "@mearie/core": "0.5.2"
56
56
  },
57
57
  "devDependencies": {
58
58
  "solid-js": "^1.9.11",