gomtm 0.0.335 → 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
  };
@@ -0,0 +1 @@
1
+ "use client";
@@ -7,7 +7,7 @@ import { buttonVariants } from "mtxuilib/ui/button";
7
7
  import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "mtxuilib/ui/card";
8
8
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "mtxuilib/ui/dropdown-menu";
9
9
  import { title } from "process";
10
- import { useState } from "react";
10
+ import { Suspense, useState } from "react";
11
11
  import { MtDateView } from "../../components/MtDate";
12
12
  import Tag from "../../components/Tag";
13
13
  import { ListViewLayout } from "../../gomtmpb/mtm/sppb/mtm_pb";
@@ -123,7 +123,7 @@ const PostCardListItem = (props) => {
123
123
  ) })
124
124
  ] })
125
125
  ] }),
126
- /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-0", children: isLogined && /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id }) })
126
+ /* @__PURE__ */ jsx("div", { className: "absolute bottom-2 right-0", children: isLogined && /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id }) }) })
127
127
  ] })
128
128
  }
129
129
  );
@@ -162,7 +162,7 @@ const PostCardListItem = (props) => {
162
162
  ] }) }),
163
163
  /* @__PURE__ */ jsxs(CardFooter, { className: "flex justify-end", children: [
164
164
  /* @__PURE__ */ jsx(MtLink, { variant: "ghost", href: `${slugPath}/${item.id}`, children: "Show" }),
165
- isLogined && /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id })
165
+ isLogined && /* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(PostCardItemActions, { id: item.id }) })
166
166
  ] })
167
167
  ]
168
168
  }
@@ -41,7 +41,7 @@ function MtListView(props) {
41
41
  svc: etc.svc,
42
42
  method: etc.methodList,
43
43
  input: etc.paramsList,
44
- children: /* @__PURE__ */ jsx(ListViewRender, { children })
44
+ children: /* @__PURE__ */ jsx(ListViewRender, {})
45
45
  }
46
46
  ) }));
47
47
  }
@@ -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
  });