houdini-react 0.0.0-20240402042937 → 0.0.0-20240402060051
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;
|
|
@@ -105,12 +105,21 @@ function Router({
|
|
|
105
105
|
loadComponent(page2);
|
|
106
106
|
}
|
|
107
107
|
if (["page", "data"].includes(which)) {
|
|
108
|
-
console.log("loading data", page2, variables2);
|
|
109
108
|
loadData(page2, variables2);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
});
|
|
113
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
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: setCurrentURL,
|
|
118
|
+
params: variables ?? {}
|
|
119
|
+
},
|
|
120
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageComponent, { url: currentURL }, page.id)
|
|
121
|
+
}
|
|
122
|
+
) });
|
|
114
123
|
}
|
|
115
124
|
const useLocation = () => (0, import_react2.useContext)(LocationContext);
|
|
116
125
|
function usePageData({
|
|
@@ -148,7 +157,6 @@ function usePageData({
|
|
|
148
157
|
const promise = new Promise((res, rej) => {
|
|
149
158
|
resolve = res;
|
|
150
159
|
reject = rej;
|
|
151
|
-
console.log("sending query", observer.artifact.name, variables2);
|
|
152
160
|
observer.send({
|
|
153
161
|
variables: variables2,
|
|
154
162
|
session
|
|
@@ -402,7 +410,9 @@ function useCurrentVariables() {
|
|
|
402
410
|
const VariableContext = import_react.default.createContext(null);
|
|
403
411
|
const LocationContext = import_react.default.createContext({
|
|
404
412
|
pathname: "",
|
|
405
|
-
params: {}
|
|
413
|
+
params: {},
|
|
414
|
+
goto: () => {
|
|
415
|
+
}
|
|
406
416
|
});
|
|
407
417
|
function useQueryResult(name) {
|
|
408
418
|
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;
|
|
@@ -64,12 +64,21 @@ function Router({
|
|
|
64
64
|
loadComponent(page2);
|
|
65
65
|
}
|
|
66
66
|
if (["page", "data"].includes(which)) {
|
|
67
|
-
console.log("loading data", page2, variables2);
|
|
68
67
|
loadData(page2, variables2);
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
});
|
|
72
|
-
return /* @__PURE__ */ jsx(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ jsx(
|
|
71
|
+
return /* @__PURE__ */ jsx(VariableContext.Provider, { value: variables, children: /* @__PURE__ */ jsx(
|
|
72
|
+
LocationContext.Provider,
|
|
73
|
+
{
|
|
74
|
+
value: {
|
|
75
|
+
pathname: currentURL,
|
|
76
|
+
goto: setCurrentURL,
|
|
77
|
+
params: variables ?? {}
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ jsx(PageComponent, { url: currentURL }, page.id)
|
|
80
|
+
}
|
|
81
|
+
) });
|
|
73
82
|
}
|
|
74
83
|
const useLocation = () => useContext(LocationContext);
|
|
75
84
|
function usePageData({
|
|
@@ -107,7 +116,6 @@ function usePageData({
|
|
|
107
116
|
const promise = new Promise((res, rej) => {
|
|
108
117
|
resolve = res;
|
|
109
118
|
reject = rej;
|
|
110
|
-
console.log("sending query", observer.artifact.name, variables2);
|
|
111
119
|
observer.send({
|
|
112
120
|
variables: variables2,
|
|
113
121
|
session
|
|
@@ -361,7 +369,9 @@ function useCurrentVariables() {
|
|
|
361
369
|
const VariableContext = React.createContext(null);
|
|
362
370
|
const LocationContext = React.createContext({
|
|
363
371
|
pathname: "",
|
|
364
|
-
params: {}
|
|
372
|
+
params: {},
|
|
373
|
+
goto: () => {
|
|
374
|
+
}
|
|
365
375
|
});
|
|
366
376
|
function useQueryResult(name) {
|
|
367
377
|
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-
|
|
3
|
+
"version": "0.0.0-20240402060051",
|
|
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-
|
|
46
|
+
"houdini": "^0.0.0-20240402060051"
|
|
47
47
|
},
|
|
48
48
|
"files": [
|
|
49
49
|
"build"
|