houdini-react 0.0.0-20240402040259 → 0.0.0-20240402041921

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.
@@ -98,10 +98,14 @@ function Router({
98
98
  },
99
99
  preload(url, which) {
100
100
  const [page2, variables2] = (0, import_match.find_match)(import_config.default, manifest, url);
101
+ if (!page2) {
102
+ return;
103
+ }
101
104
  if (["page", "component"].includes(which)) {
102
105
  loadComponent(page2);
103
106
  }
104
107
  if (["page", "data"].includes(which)) {
108
+ console.log("loading data", page2, variables2);
105
109
  loadData(page2, variables2);
106
110
  }
107
111
  }
@@ -149,7 +153,6 @@ function usePageData({
149
153
  variables: variables2,
150
154
  session
151
155
  }).then(async () => {
152
- console.log("query resolved", observer.artifact.name, observer.state);
153
156
  data_cache.set(id, observer);
154
157
  if (observer.state.errors && observer.state.errors.length > 0) {
155
158
  reject(observer.state.errors.map((e) => e.message).join("\n"));
@@ -249,6 +252,9 @@ function usePageData({
249
252
  return resolvable;
250
253
  }
251
254
  function loadData(targetPage, variables2) {
255
+ if (!targetPage) {
256
+ return;
257
+ }
252
258
  for (const [artifact, { variables: pageVariables }] of Object.entries(
253
259
  targetPage.documents
254
260
  )) {
@@ -57,10 +57,14 @@ function Router({
57
57
  },
58
58
  preload(url, which) {
59
59
  const [page2, variables2] = find_match(configFile, manifest, url);
60
+ if (!page2) {
61
+ return;
62
+ }
60
63
  if (["page", "component"].includes(which)) {
61
64
  loadComponent(page2);
62
65
  }
63
66
  if (["page", "data"].includes(which)) {
67
+ console.log("loading data", page2, variables2);
64
68
  loadData(page2, variables2);
65
69
  }
66
70
  }
@@ -108,7 +112,6 @@ function usePageData({
108
112
  variables: variables2,
109
113
  session
110
114
  }).then(async () => {
111
- console.log("query resolved", observer.artifact.name, observer.state);
112
115
  data_cache.set(id, observer);
113
116
  if (observer.state.errors && observer.state.errors.length > 0) {
114
117
  reject(observer.state.errors.map((e) => e.message).join("\n"));
@@ -208,6 +211,9 @@ function usePageData({
208
211
  return resolvable;
209
212
  }
210
213
  function loadData(targetPage, variables2) {
214
+ if (!targetPage) {
215
+ return;
216
+ }
211
217
  for (const [artifact, { variables: pageVariables }] of Object.entries(
212
218
  targetPage.documents
213
219
  )) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "0.0.0-20240402040259",
3
+ "version": "0.0.0-20240402041921",
4
4
  "description": "The React plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -43,7 +43,7 @@
43
43
  "recast": "^0.23.1",
44
44
  "rollup": "^3.7.4",
45
45
  "use-deep-compare-effect": "^1.8.1",
46
- "houdini": "^0.0.0-20240402040259"
46
+ "houdini": "^0.0.0-20240402041921"
47
47
  },
48
48
  "files": [
49
49
  "build"