Skip to content

Commit f933741

Browse files
committed
enhance Button's label check before unwrapping it
1 parent 521f49e commit f933741

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

.changeset/thin-pens-push.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@ensembleui/react-kitchen-sink": patch
3+
"@ensembleui/react-runtime": patch
4+
---
5+
6+
enhance Button's label check before unwrapping it

packages/runtime/src/widgets/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type { EnsembleWidgetProps, IconProps } from "../shared/types";
1313
import { useEnsembleAction } from "../runtime/hooks/useEnsembleAction";
1414
import { Icon } from "./Icon";
1515
import { EnsembleRuntime } from "../runtime";
16-
import { isString } from "lodash-es";
16+
import { isObject, isString } from "lodash-es";
1717

1818
const widgetName = "Button";
1919

@@ -63,7 +63,7 @@ export const Button: React.FC<ButtonProps> = ({ id, onTap, ...rest }) => {
6363
const label = useMemo(() => {
6464
const rawLabel = values?.label;
6565
if (!rawLabel) return null;
66-
if (isString(rawLabel)) return rawLabel;
66+
if (!isObject(rawLabel)) return rawLabel;
6767
return EnsembleRuntime.render([unwrapWidget(rawLabel)]);
6868
}, [values?.label]);
6969

0 commit comments

Comments
 (0)