@overmap-ai/blocks 1.0.30-softer-icon-error.0 → 1.0.31-fix-error-boundary.0
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.
- package/README.md +3 -3
- package/dist/OvermapErrorBoundary/OvermapErrorBoundary.d.ts +1 -0
- package/dist/blocks.js +21 -5
- package/dist/blocks.js.map +1 -1
- package/dist/blocks.umd.cjs +21 -5
- package/dist/blocks.umd.cjs.map +1 -1
- package/dist/style.css +16 -16
- package/package.json +1 -1
package/dist/blocks.umd.cjs
CHANGED
|
@@ -2724,20 +2724,24 @@
|
|
|
2724
2724
|
const Separator$1 = React.memo(_Separator);
|
|
2725
2725
|
const centerStyles = { placeSelf: "center" };
|
|
2726
2726
|
const ErrorFallback = React.memo((props) => {
|
|
2727
|
-
const { absoluteCentering } = props;
|
|
2727
|
+
const { absoluteCentering, message = "Something went wrong", onRetry } = props;
|
|
2728
2728
|
const { resetBoundary } = reactErrorBoundary.useErrorBoundary();
|
|
2729
2729
|
const height = "20px";
|
|
2730
2730
|
const outerFlexStyles = absoluteCentering ? { position: "absolute", top: "50%", transform: "translateY(-50%)" } : void 0;
|
|
2731
|
+
const handleRetry = React.useCallback(() => {
|
|
2732
|
+
resetBoundary();
|
|
2733
|
+
onRetry();
|
|
2734
|
+
}, [onRetry, resetBoundary]);
|
|
2731
2735
|
return /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: "2", direction: "row", width: "100%", style: outerFlexStyles, children: [
|
|
2732
2736
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flexGrow: 1 } }),
|
|
2733
2737
|
/* @__PURE__ */ jsxRuntime.jsx(RiIcon, { icon: "RiAlertLine", size: height, style: centerStyles }),
|
|
2734
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children:
|
|
2738
|
+
/* @__PURE__ */ jsxRuntime.jsx(Text$1, { style: { lineHeight: height, ...centerStyles }, children: message }),
|
|
2735
2739
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2736
2740
|
IconButton,
|
|
2737
2741
|
{
|
|
2738
2742
|
"aria-label": "Try again",
|
|
2739
2743
|
variant: "soft",
|
|
2740
|
-
onClick:
|
|
2744
|
+
onClick: handleRetry,
|
|
2741
2745
|
style: centerStyles,
|
|
2742
2746
|
hoverEffects: ["spin180Clockwise"],
|
|
2743
2747
|
children: /* @__PURE__ */ jsxRuntime.jsx(RiIcon, { icon: "RiLoopLeftLine", size: height })
|
|
@@ -2748,11 +2752,23 @@
|
|
|
2748
2752
|
});
|
|
2749
2753
|
ErrorFallback.displayName = "ErrorFallback";
|
|
2750
2754
|
const OvermapErrorBoundary = React.memo((props) => {
|
|
2751
|
-
const { absoluteCentering } = props;
|
|
2755
|
+
const { absoluteCentering, message } = props;
|
|
2756
|
+
const [attempt, setAttempt] = React.useState(0);
|
|
2752
2757
|
const logError = React.useCallback((error, info) => {
|
|
2753
2758
|
console.error(error, info);
|
|
2754
2759
|
}, []);
|
|
2755
|
-
|
|
2760
|
+
const handleRetry = React.useCallback(() => {
|
|
2761
|
+
setAttempt((prev) => prev + 1);
|
|
2762
|
+
}, []);
|
|
2763
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2764
|
+
reactErrorBoundary.ErrorBoundary,
|
|
2765
|
+
{
|
|
2766
|
+
fallback: /* @__PURE__ */ jsxRuntime.jsx(ErrorFallback, { absoluteCentering, message, onRetry: handleRetry }),
|
|
2767
|
+
onError: logError,
|
|
2768
|
+
children: props.children
|
|
2769
|
+
},
|
|
2770
|
+
attempt
|
|
2771
|
+
);
|
|
2756
2772
|
});
|
|
2757
2773
|
OvermapErrorBoundary.displayName = "OvermapErrorBoundary";
|
|
2758
2774
|
const OvermapInputItem$1 = "_OvermapInputItem_1jgzv_1";
|