gomtm 0.0.273 → 0.0.274

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.
@@ -2,5 +2,6 @@
2
2
  import { PlainMessage } from "@bufbuild/protobuf";
3
3
  import { MtmError } from "../gomtmpb/mtm/sppb/mtm_pb";
4
4
  export declare const MtmErrorView: (props: {
5
- gomtmError: PlainMessage<MtmError>;
5
+ unaryError: PlainMessage<MtmError>;
6
+ retry?: () => void;
6
7
  }) => import("react").JSX.Element;
@@ -1,10 +1,14 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  const MtmErrorView = (props) => {
4
- const { gomtmError } = props;
5
- return /* @__PURE__ */ jsxs("div", { children: [
6
- "MtmErrorView",
7
- /* @__PURE__ */ jsx("pre", { children: JSON.stringify(gomtmError, null, 2) })
4
+ const { unaryError, retry } = props;
5
+ return /* @__PURE__ */ jsxs("div", { className: "bg-red-400 p-4", children: [
6
+ "code: ",
7
+ unaryError.errCode,
8
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("pre", { className: "prose dark:prose-invert max-w-96 flex-wrap text-wrap break-words", children: unaryError.errMessage }) }),
9
+ retry && /* @__PURE__ */ jsx("button", { onClick: () => {
10
+ retry();
11
+ }, children: "retry" })
8
12
  ] });
9
13
  };
10
14
  export {
@@ -47,7 +47,7 @@ import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel
47
47
  import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "mtxuilib/ui/pagination";
48
48
  import { MtButton } from "mtxuilib/ui/ui-mt/Button";
49
49
  import { Suspense, createContext, useCallback, useContext, useMemo, useState } from "react";
50
- import { MtUnaryCallErrorView } from "../components/MtUnaryCallErrorView";
50
+ import { MtmErrorView } from "../components/MtmErrorView";
51
51
  import { useMutation, useSuspenseInfiniteQuery } from "../connectquery";
52
52
  import { useMtmApp } from "../providers/GomtmProvider";
53
53
  import { DlgCurdDebugInfo, DlgCurdDebugInfoTriggerButton } from "./CurdDetailProvider";
@@ -91,7 +91,7 @@ function ListViewProvider(props) {
91
91
  setOpenDebug,
92
92
  params,
93
93
  setParams
94
- }, children: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "loading list" }), children }) });
94
+ }, children });
95
95
  }
96
96
  function useListView() {
97
97
  const ctx = useContext(commonListViewContext);
@@ -132,7 +132,7 @@ function CommonListView() {
132
132
  children: listQuery.data.pages.map((page, i) => {
133
133
  var _a;
134
134
  if (page.errCode) {
135
- return /* @__PURE__ */ jsx(MtUnaryCallErrorView, { unaryError: page }, i);
135
+ return /* @__PURE__ */ jsx(MtmErrorView, { unaryError: page }, i);
136
136
  } else {
137
137
  return /* @__PURE__ */ jsx(ListLayout, { layout: page.listLayout, children: (_a = page == null ? void 0 : page.items) == null ? void 0 : _a.map((item, j) => /* @__PURE__ */ jsx(ListItemView, { item }, `${i}-${j}`)) }, i);
138
138
  }
@@ -61,16 +61,14 @@ const gomtmApiUrl = () => {
61
61
  function createMtmServiceClient(service, url) {
62
62
  return createPromiseClient(
63
63
  service,
64
- createConnectTransport({
65
- baseUrl: gomtmApiUrl(),
66
- fetch: gomtmFetcher()
67
- })
64
+ createTransport()
68
65
  );
69
66
  }
70
67
  function createTransport() {
71
68
  return createConnectTransport({
72
69
  baseUrl: gomtmApiUrl(),
73
- fetch: gomtmFetcher()
70
+ fetch: gomtmFetcher(),
71
+ useHttpGet: true
74
72
  });
75
73
  }
76
74
  function createMtmServiceClientByName(svcName, url) {
@@ -111,7 +109,7 @@ const gomtmFetcher = (initGlobal) => {
111
109
  }, (initGlobal == null ? void 0 : initGlobal.cookieStr) && { "Cookie": initGlobal == null ? void 0 : initGlobal.cookieStr })
112
110
  });
113
111
  let fetcher = fetch;
114
- req.enableCache = false;
112
+ req.enableCache = true;
115
113
  if (req.enableCache) {
116
114
  fetcher = fetchMiddleWithCache(fetch);
117
115
  }