houdini-react 0.0.0-20240402060051 → 0.0.0-20240402063326

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.
@@ -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) {
@@ -92,10 +92,12 @@ function Router({
92
92
  window.removeEventListener("popstate", onChange);
93
93
  };
94
94
  }, []);
95
+ const goto = (url) => {
96
+ data_cache.clear();
97
+ setCurrentURL(url);
98
+ };
95
99
  useLinkBehavior({
96
- goto: (val) => {
97
- setCurrentURL(val);
98
- },
100
+ goto,
99
101
  preload(url, which) {
100
102
  const [page2, variables2] = (0, import_match.find_match)(import_config.default, manifest, url);
101
103
  if (!page2) {
@@ -114,7 +116,7 @@ function Router({
114
116
  {
115
117
  value: {
116
118
  pathname: currentURL,
117
- goto: setCurrentURL,
119
+ goto,
118
120
  params: variables ?? {}
119
121
  },
120
122
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageComponent, { url: currentURL }, page.id)
@@ -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) {
@@ -51,10 +51,12 @@ function Router({
51
51
  window.removeEventListener("popstate", onChange);
52
52
  };
53
53
  }, []);
54
+ const goto = (url) => {
55
+ data_cache.clear();
56
+ setCurrentURL(url);
57
+ };
54
58
  useLinkBehavior({
55
- goto: (val) => {
56
- setCurrentURL(val);
57
- },
59
+ goto,
58
60
  preload(url, which) {
59
61
  const [page2, variables2] = find_match(configFile, manifest, url);
60
62
  if (!page2) {
@@ -73,7 +75,7 @@ function Router({
73
75
  {
74
76
  value: {
75
77
  pathname: currentURL,
76
- goto: setCurrentURL,
78
+ goto,
77
79
  params: variables ?? {}
78
80
  },
79
81
  children: /* @__PURE__ */ jsx(PageComponent, { url: currentURL }, page.id)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-react",
3
- "version": "0.0.0-20240402060051",
3
+ "version": "0.0.0-20240402063326",
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-20240402060051"
46
+ "houdini": "^0.0.0-20240402063326"
47
47
  },
48
48
  "files": [
49
49
  "build"