houdini-react 0.0.0-20240402043110 → 0.0.0-20240402063001

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.
@@ -22,6 +22,7 @@ export declare function Router({ manifest, initialURL, assetPrefix, injectToStre
22
22
  export declare const useLocation: () => {
23
23
  pathname: string;
24
24
  params: Record<string, any>;
25
+ goto: (url: string) => void;
25
26
  };
26
27
  export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session: ssrSession, }: {
27
28
  children: React.ReactElement;
@@ -22,6 +22,7 @@ export declare function Router({ manifest, initialURL, assetPrefix, injectToStre
22
22
  export declare const useLocation: () => {
23
23
  pathname: string;
24
24
  params: Record<string, any>;
25
+ goto: (url: string) => void;
25
26
  };
26
27
  export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session: ssrSession, }: {
27
28
  children: React.ReactElement;
@@ -73,7 +73,7 @@ function Router({
73
73
  assetPrefix,
74
74
  injectToStream
75
75
  });
76
- const { component_cache } = useRouterContext();
76
+ const { component_cache, data_cache } = useRouterContext();
77
77
  const PageComponent = component_cache.get(page.id);
78
78
  import_react.default.useEffect(() => {
79
79
  if (globalThis.window && window.location.pathname !== currentURL) {
@@ -109,7 +109,20 @@ function Router({
109
109
  }
110
110
  }
111
111
  });
112
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LocationContext.Provider, { value: { pathname: currentURL, params: variables ?? {} }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageComponent, { url: currentURL }, page.id) }) });
112
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
113
+ LocationContext.Provider,
114
+ {
115
+ value: {
116
+ pathname: currentURL,
117
+ goto: (url) => {
118
+ data_cache.clear();
119
+ setCurrentURL(url);
120
+ },
121
+ params: variables ?? {}
122
+ },
123
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageComponent, { url: currentURL }, page.id)
124
+ }
125
+ ) });
113
126
  }
114
127
  const useLocation = () => (0, import_react2.useContext)(LocationContext);
115
128
  function usePageData({
@@ -400,7 +413,9 @@ function useCurrentVariables() {
400
413
  const VariableContext = import_react.default.createContext(null);
401
414
  const LocationContext = import_react.default.createContext({
402
415
  pathname: "",
403
- params: {}
416
+ params: {},
417
+ goto: () => {
418
+ }
404
419
  });
405
420
  function useQueryResult(name) {
406
421
  const { data_cache, artifact_cache } = useRouterContext();
@@ -22,6 +22,7 @@ export declare function Router({ manifest, initialURL, assetPrefix, injectToStre
22
22
  export declare const useLocation: () => {
23
23
  pathname: string;
24
24
  params: Record<string, any>;
25
+ goto: (url: string) => void;
25
26
  };
26
27
  export declare function RouterContextProvider({ children, client, cache, artifact_cache, component_cache, data_cache, ssr_signals, last_variables, session: ssrSession, }: {
27
28
  children: React.ReactElement;
@@ -32,7 +32,7 @@ function Router({
32
32
  assetPrefix,
33
33
  injectToStream
34
34
  });
35
- const { component_cache } = useRouterContext();
35
+ const { component_cache, data_cache } = useRouterContext();
36
36
  const PageComponent = component_cache.get(page.id);
37
37
  React.useEffect(() => {
38
38
  if (globalThis.window && window.location.pathname !== currentURL) {
@@ -68,7 +68,20 @@ function Router({
68
68
  }
69
69
  }
70
70
  });
71
- return /* @__PURE__ */ jsx(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ jsx(LocationContext.Provider, { value: { pathname: currentURL, params: variables ?? {} }, children: /* @__PURE__ */ jsx(PageComponent, { url: currentURL }, page.id) }) });
71
+ return /* @__PURE__ */ jsx(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ jsx(
72
+ LocationContext.Provider,
73
+ {
74
+ value: {
75
+ pathname: currentURL,
76
+ goto: (url) => {
77
+ data_cache.clear();
78
+ setCurrentURL(url);
79
+ },
80
+ params: variables ?? {}
81
+ },
82
+ children: /* @__PURE__ */ jsx(PageComponent, { url: currentURL }, page.id)
83
+ }
84
+ ) });
72
85
  }
73
86
  const useLocation = () => useContext(LocationContext);
74
87
  function usePageData({
@@ -359,7 +372,9 @@ function useCurrentVariables() {
359
372
  const VariableContext = React.createContext(null);
360
373
  const LocationContext = React.createContext({
361
374
  pathname: "",
362
- params: {}
375
+ params: {},
376
+ goto: () => {
377
+ }
363
378
  });
364
379
  function useQueryResult(name) {
365
380
  const { data_cache, artifact_cache } = useRouterContext();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "0.0.0-20240402043110",
3
+ "version": "0.0.0-20240402063001",
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-20240402043110"
46
+ "houdini": "^0.0.0-20240402063001"
47
47
  },
48
48
  "files": [
49
49
  "build"