gomtm 0.0.336 → 0.0.337
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.
|
@@ -4,3 +4,8 @@ export declare function PrefetchConnectInfiniteQuery(props: {
|
|
|
4
4
|
method: string;
|
|
5
5
|
input?: any;
|
|
6
6
|
} & PropsWithChildren): Promise<import("react").JSX.Element>;
|
|
7
|
+
export declare function PrefetchConnectQuery(props: {
|
|
8
|
+
svc: string;
|
|
9
|
+
method: string;
|
|
10
|
+
input?: any;
|
|
11
|
+
} & PropsWithChildren): Promise<import("react").JSX.Element>;
|
|
@@ -36,7 +36,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
36
36
|
};
|
|
37
37
|
import { jsx } from "react/jsx-runtime";
|
|
38
38
|
import { HydrationBoundary, QueryClient, dehydrate } from "@tanstack/react-query";
|
|
39
|
-
import { createInfiniteQueryKey, goMtmQueryFn } from "../mtmFetcher";
|
|
39
|
+
import { createInfiniteQueryKey, createQueryKey, goMtmQueryFn } from "../mtmFetcher";
|
|
40
40
|
function PrefetchConnectInfiniteQuery(props) {
|
|
41
41
|
return __async(this, null, function* () {
|
|
42
42
|
const { svc, method, input, children } = props;
|
|
@@ -54,6 +54,23 @@ function PrefetchConnectInfiniteQuery(props) {
|
|
|
54
54
|
return /* @__PURE__ */ jsx(HydrationBoundary, { state: dehydratedState, children });
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
+
function PrefetchConnectQuery(props) {
|
|
58
|
+
return __async(this, null, function* () {
|
|
59
|
+
const { svc, method, input, children } = props;
|
|
60
|
+
const queryClient = new QueryClient();
|
|
61
|
+
const queryKey = createQueryKey(svc, method, input);
|
|
62
|
+
const data = yield goMtmQueryFn({ svc, method, input });
|
|
63
|
+
yield queryClient.prefetchQuery({
|
|
64
|
+
queryKey,
|
|
65
|
+
queryFn: (k) => __async(this, null, function* () {
|
|
66
|
+
return data;
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
const dehydratedState = dehydrate(queryClient);
|
|
70
|
+
return /* @__PURE__ */ jsx(HydrationBoundary, { state: dehydratedState, children });
|
|
71
|
+
});
|
|
72
|
+
}
|
|
57
73
|
export {
|
|
58
|
-
PrefetchConnectInfiniteQuery
|
|
74
|
+
PrefetchConnectInfiniteQuery,
|
|
75
|
+
PrefetchConnectQuery
|
|
59
76
|
};
|
|
@@ -39,7 +39,9 @@ var __async = (__this, __arguments, generator) => {
|
|
|
39
39
|
};
|
|
40
40
|
import { jsx } from "react/jsx-runtime";
|
|
41
41
|
import { cookies, headers } from "next/headers";
|
|
42
|
+
import { PrefetchConnectQuery } from "../components/SSR";
|
|
42
43
|
import { CONST_COOKIE_MtM_TOKEN_NAME, CookieConfigState } from "../consts";
|
|
44
|
+
import { userinfo } from "../gomtmpb/mtm/sppb/mtm-MtmService_connectquery";
|
|
43
45
|
import { ssrGetBackendUrl } from "../mtmFetcher";
|
|
44
46
|
import { GoMtmAppProvider } from "../store/mtapp-store";
|
|
45
47
|
function GomtmAppSS(props) {
|
|
@@ -59,7 +61,14 @@ function GomtmAppSS(props) {
|
|
|
59
61
|
token,
|
|
60
62
|
backendUrl: (cState == null ? void 0 : cState.backendUrl) || backend,
|
|
61
63
|
gomtmHost,
|
|
62
|
-
children
|
|
64
|
+
children: /* @__PURE__ */ jsx(
|
|
65
|
+
PrefetchConnectQuery,
|
|
66
|
+
{
|
|
67
|
+
svc: userinfo.service.typeName,
|
|
68
|
+
method: userinfo.name,
|
|
69
|
+
children
|
|
70
|
+
}
|
|
71
|
+
)
|
|
63
72
|
})
|
|
64
73
|
);
|
|
65
74
|
});
|