houdini-svelte 1.1.2 → 1.1.3

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.
@@ -34,10 +34,11 @@ class QueryStoreCursor extends import_query.QueryStore {
34
34
  super(config);
35
35
  }
36
36
  #_handlers = null;
37
- get #handlers() {
37
+ async #handlers() {
38
38
  if (this.#_handlers) {
39
39
  return this.#_handlers;
40
40
  }
41
+ await (0, import_client.initClient)();
41
42
  const paginationObserver = (0, import_client.getClient)().observe({
42
43
  artifact: this.artifact
43
44
  });
@@ -49,14 +50,12 @@ class QueryStoreCursor extends import_query.QueryStore {
49
50
  storeName: this.name,
50
51
  fetch: super.fetch.bind(this),
51
52
  fetchUpdate: async (args, updates) => {
52
- await (0, import_client.initClient)();
53
53
  return paginationObserver.send({
54
54
  ...args,
55
- variables: {
56
- ...args?.variables
57
- },
58
55
  cacheParams: {
59
- applyUpdates: updates
56
+ applyUpdates: updates,
57
+ disableSubscriptions: true,
58
+ ...args?.cacheParams
60
59
  }
61
60
  });
62
61
  }
@@ -64,13 +63,16 @@ class QueryStoreCursor extends import_query.QueryStore {
64
63
  return this.#_handlers;
65
64
  }
66
65
  async fetch(args) {
67
- return this.#handlers.fetch.call(this, args);
66
+ const handlers = await this.#handlers();
67
+ return await handlers.fetch.call(this, args);
68
68
  }
69
69
  async loadPreviousPage(args) {
70
- return this.#handlers.loadPreviousPage(args);
70
+ const handlers = await this.#handlers();
71
+ return await handlers.loadPreviousPage(args);
71
72
  }
72
73
  async loadNextPage(args) {
73
- return this.#handlers.loadNextPage(args);
74
+ const handlers = await this.#handlers();
75
+ return await handlers.loadNextPage(args);
74
76
  }
75
77
  subscribe(run, invalidate) {
76
78
  const combined = (0, import_store.derived)([{ subscribe: super.subscribe.bind(this) }], ([$parent]) => {
@@ -85,16 +87,19 @@ class QueryStoreCursor extends import_query.QueryStore {
85
87
  class QueryStoreOffset extends import_query.QueryStore {
86
88
  paginated = true;
87
89
  async loadNextPage(args) {
88
- return this.#handlers.loadNextPage.call(this, args);
90
+ const handlers = await this.#handlers();
91
+ return await handlers.loadNextPage.call(this, args);
89
92
  }
90
- fetch(args) {
91
- return this.#handlers.fetch.call(this, args);
93
+ async fetch(args) {
94
+ const handlers = await this.#handlers();
95
+ return await handlers.fetch.call(this, args);
92
96
  }
93
97
  #_handlers = null;
94
- get #handlers() {
98
+ async #handlers() {
95
99
  if (this.#_handlers) {
96
100
  return this.#_handlers;
97
101
  }
102
+ await (0, import_client.initClient)();
98
103
  const paginationObserver = (0, import_client.getClient)().observe({
99
104
  artifact: this.artifact
100
105
  });
@@ -10,10 +10,11 @@ class QueryStoreCursor extends QueryStore {
10
10
  super(config);
11
11
  }
12
12
  #_handlers = null;
13
- get #handlers() {
13
+ async #handlers() {
14
14
  if (this.#_handlers) {
15
15
  return this.#_handlers;
16
16
  }
17
+ await initClient();
17
18
  const paginationObserver = getClient().observe({
18
19
  artifact: this.artifact
19
20
  });
@@ -25,14 +26,12 @@ class QueryStoreCursor extends QueryStore {
25
26
  storeName: this.name,
26
27
  fetch: super.fetch.bind(this),
27
28
  fetchUpdate: async (args, updates) => {
28
- await initClient();
29
29
  return paginationObserver.send({
30
30
  ...args,
31
- variables: {
32
- ...args?.variables
33
- },
34
31
  cacheParams: {
35
- applyUpdates: updates
32
+ applyUpdates: updates,
33
+ disableSubscriptions: true,
34
+ ...args?.cacheParams
36
35
  }
37
36
  });
38
37
  }
@@ -40,13 +39,16 @@ class QueryStoreCursor extends QueryStore {
40
39
  return this.#_handlers;
41
40
  }
42
41
  async fetch(args) {
43
- return this.#handlers.fetch.call(this, args);
42
+ const handlers = await this.#handlers();
43
+ return await handlers.fetch.call(this, args);
44
44
  }
45
45
  async loadPreviousPage(args) {
46
- return this.#handlers.loadPreviousPage(args);
46
+ const handlers = await this.#handlers();
47
+ return await handlers.loadPreviousPage(args);
47
48
  }
48
49
  async loadNextPage(args) {
49
- return this.#handlers.loadNextPage(args);
50
+ const handlers = await this.#handlers();
51
+ return await handlers.loadNextPage(args);
50
52
  }
51
53
  subscribe(run, invalidate) {
52
54
  const combined = derived([{ subscribe: super.subscribe.bind(this) }], ([$parent]) => {
@@ -61,16 +63,19 @@ class QueryStoreCursor extends QueryStore {
61
63
  class QueryStoreOffset extends QueryStore {
62
64
  paginated = true;
63
65
  async loadNextPage(args) {
64
- return this.#handlers.loadNextPage.call(this, args);
66
+ const handlers = await this.#handlers();
67
+ return await handlers.loadNextPage.call(this, args);
65
68
  }
66
- fetch(args) {
67
- return this.#handlers.fetch.call(this, args);
69
+ async fetch(args) {
70
+ const handlers = await this.#handlers();
71
+ return await handlers.fetch.call(this, args);
68
72
  }
69
73
  #_handlers = null;
70
- get #handlers() {
74
+ async #handlers() {
71
75
  if (this.#_handlers) {
72
76
  return this.#_handlers;
73
77
  }
78
+ await initClient();
74
79
  const paginationObserver = getClient().observe({
75
80
  artifact: this.artifact
76
81
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
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.57.0",
34
34
  "vite": "^4.1.1",
35
- "houdini": "^1.1.2"
35
+ "houdini": "^1.1.3"
36
36
  },
37
37
  "files": [
38
38
  "build"