@cccsaurora/clue-ui 1.2.2-dev.263 → 1.2.3-dev.266

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.
@@ -65,11 +65,13 @@ const Fetcher = React__default.memo(
65
65
  try {
66
66
  setLoading(true);
67
67
  setResult(await fetchSelector(fetcherId, { type, value, classification }));
68
+ } catch {
69
+ setResult({ outcome: "failure", done: true, error: t("fetcher.error.unexpected") });
68
70
  } finally {
69
71
  setLoading(false);
70
72
  }
71
73
  })();
72
- }, [classification, fetchSelector, fetcherId, type, value]);
74
+ }, [classification, fetchSelector, fetcherId, t, type, value]);
73
75
  if (fetchCompleted) {
74
76
  if (!fetcherId) {
75
77
  console.warn("Missing fetcher Id. Component will not render.");
@@ -105,7 +107,8 @@ const Fetcher = React__default.memo(
105
107
  return /* @__PURE__ */ jsx(Skeleton, { variant: "rounded", height: "325px", width: "300px", ...skeletonProps });
106
108
  }
107
109
  }
108
- if ((result == null ? void 0 : result.outcome) === "failure" && fetchers[fetcherId].format === "status") {
110
+ if (!result) return null;
111
+ if (result.outcome === "failure" && fetchers[fetcherId].format === "status") {
109
112
  return /* @__PURE__ */ jsx(
110
113
  Chip,
111
114
  {
@@ -129,7 +132,7 @@ const Fetcher = React__default.memo(
129
132
  )
130
133
  ] });
131
134
  }
132
- if ((result == null ? void 0 : result.format) === "status") {
135
+ if (result.format === "status") {
133
136
  return /* @__PURE__ */ jsx(StatusChip, { data: result.data, ...chipProps });
134
137
  }
135
138
  return /* @__PURE__ */ jsx(
@@ -161,11 +164,11 @@ const Fetcher = React__default.memo(
161
164
  }
162
165
  },
163
166
  children: [
164
- (result == null ? void 0 : result.outcome) === "failure" && /* @__PURE__ */ jsx("code", { style: { color: theme.palette.error.main }, children: /* @__PURE__ */ jsx("pre", { style: { marginTop: 0, marginBottom: 0 }, children: result.error }) }),
165
- (result == null ? void 0 : result.format) === "markdown" && /* @__PURE__ */ jsx(Markdown, { md: result.data }),
166
- (result == null ? void 0 : result.format) === "image" && /* @__PURE__ */ jsx("img", { src: result.data.image, alt: result.data.alt, ...imageProps, onClick: () => setShowPreview(true) }),
167
- (result == null ? void 0 : result.format) === "json" && /* @__PURE__ */ jsx(Box, { sx: { ".react-json-view": { backgroundColor: "transparent !important" } }, children: /* @__PURE__ */ jsx(JSONViewer, { data: result.data }) }),
168
- (result == null ? void 0 : result.format) === "graph" && /* @__PURE__ */ jsx(Graph, { graph: result.data, sx: { minHeight: "600px" } }),
167
+ result.outcome === "failure" && /* @__PURE__ */ jsx("code", { style: { color: theme.palette.error.main }, children: /* @__PURE__ */ jsx("pre", { style: { marginTop: 0, marginBottom: 0 }, children: result.error }) }),
168
+ result.format === "markdown" && /* @__PURE__ */ jsx(Markdown, { md: result.data }),
169
+ result.format === "image" && /* @__PURE__ */ jsx("img", { src: result.data.image, alt: result.data.alt, ...imageProps, onClick: () => setShowPreview(true) }),
170
+ result.format === "json" && /* @__PURE__ */ jsx(Box, { sx: { ".react-json-view": { backgroundColor: "transparent !important" } }, children: /* @__PURE__ */ jsx(JSONViewer, { data: result.data }) }),
171
+ result.format === "graph" && /* @__PURE__ */ jsx(Graph, { graph: result.data, sx: { minHeight: "600px" } }),
169
172
  /* @__PURE__ */ jsx(FlexOne, {}),
170
173
  /* @__PURE__ */ jsxs(
171
174
  Stack,
@@ -207,7 +210,7 @@ const Fetcher = React__default.memo(
207
210
  }
208
211
  ),
209
212
  /* @__PURE__ */ jsx(FlexOne, {}),
210
- (result == null ? void 0 : result.link) && /* @__PURE__ */ jsx(IconButton, { size: "small", component: "a", href: result.link, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
213
+ result.link && /* @__PURE__ */ jsx(IconButton, { size: "small", component: "a", href: result.link, children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
211
214
  ]
212
215
  }
213
216
  ),
@@ -51,6 +51,7 @@
51
51
  "drawer.mail.trash": "Trash",
52
52
  "enrich": "Enrich",
53
53
  "error": "Error",
54
+ "fetcher.error.unexpected": "An unexpected error occurred",
54
55
  "graph.no.dataset": "No dataset has been selected!",
55
56
  "graph.node.input.label": "Enter a node ID, and press [ctrl + enter] to select it. [ctrl + space] will open an autocomplete menu.",
56
57
  "graph.show.more": "show more",
@@ -51,6 +51,7 @@
51
51
  "drawer.mail.trash": "Poubelle",
52
52
  "enrich": "Enrichir",
53
53
  "error": "Erreur",
54
+ "fetcher.error.unexpected": "Une erreur inattendue s'est produite",
54
55
  "graph.no.dataset": "Aucun jeu de données n'a été sélectionné!",
55
56
  "graph.node.input.label": "Entrez un ID de nœud et appuyez sur [ctrl + entrée] pour le sélectionner. [ctrl + espace] ouvrira un menu d'auto-complétion.",
56
57
  "graph.show.more": "Afficher plus",
package/package.json CHANGED
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "type": "module",
68
68
  "types": "main.d.ts",
69
- "version": "1.2.2-dev.263",
69
+ "version": "1.2.3-dev.266",
70
70
  "exports": {
71
71
  ".": "./main.js",
72
72
  "./index.css": "./index.css",