@mearie/vue 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 useQuery = ((query, variables, options) => {
25
25
  const metadata = (0, vue.ref)();
26
26
  let unsubscribe = null;
27
27
  let initialized = false;
28
- const execute = () => {
28
+ const execute = (force = false) => {
29
29
  unsubscribe?.();
30
- if ((0, vue.toValue)(options)?.skip) return;
31
- if (!initialized && initialOpts?.initialData) loading.value = true;
30
+ if (!force && (0, vue.toValue)(options)?.skip) {
31
+ loading.value = false;
32
+ return;
33
+ }
34
+ if (initialized || !initialOpts?.initialData) loading.value = true;
32
35
  initialized = true;
33
36
  error.value = void 0;
34
37
  unsubscribe = (0, _mearie_core_stream.pipe)(client.executeQuery(query, (0, vue.toValue)(variables), (0, vue.toValue)(options)), (0, _mearie_core_stream.subscribe)({ next: (result) => {
@@ -43,6 +46,7 @@ const useQuery = ((query, variables, options) => {
43
46
  }
44
47
  } }));
45
48
  };
49
+ const refetch = () => execute(true);
46
50
  (0, vue.watchEffect)((onCleanup) => {
47
51
  execute();
48
52
  onCleanup(() => {
@@ -54,7 +58,7 @@ const useQuery = ((query, variables, options) => {
54
58
  loading,
55
59
  error,
56
60
  metadata,
57
- refetch: execute
61
+ refetch
58
62
  };
59
63
  });
60
64
 
package/dist/index.mjs CHANGED
@@ -26,10 +26,13 @@ const useQuery = ((query, variables, options) => {
26
26
  const metadata = ref();
27
27
  let unsubscribe = null;
28
28
  let initialized = false;
29
- const execute = () => {
29
+ const execute = (force = false) => {
30
30
  unsubscribe?.();
31
- if (toValue(options)?.skip) return;
32
- if (!initialized && initialOpts?.initialData) loading.value = true;
31
+ if (!force && toValue(options)?.skip) {
32
+ loading.value = false;
33
+ return;
34
+ }
35
+ if (initialized || !initialOpts?.initialData) loading.value = true;
33
36
  initialized = true;
34
37
  error.value = void 0;
35
38
  unsubscribe = pipe(client.executeQuery(query, toValue(variables), toValue(options)), subscribe({ next: (result) => {
@@ -44,6 +47,7 @@ const useQuery = ((query, variables, options) => {
44
47
  }
45
48
  } }));
46
49
  };
50
+ const refetch = () => execute(true);
47
51
  watchEffect((onCleanup) => {
48
52
  execute();
49
53
  onCleanup(() => {
@@ -55,7 +59,7 @@ const useQuery = ((query, variables, options) => {
55
59
  loading,
56
60
  error,
57
61
  metadata,
58
- refetch: execute
62
+ refetch
59
63
  };
60
64
  });
61
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearie/vue",
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
  "tsdown": "^0.20.3",