From c0440dfb252fb7add82844dfae8eeceffc199a1e Mon Sep 17 00:00:00 2001 From: anserwaseem Date: Sat, 4 Oct 2025 01:44:20 +0500 Subject: [PATCH] enhance Button's label check before unwrapping it --- .changeset/thin-pens-push.md | 6 ++++++ packages/runtime/src/widgets/Button.tsx | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/thin-pens-push.md diff --git a/.changeset/thin-pens-push.md b/.changeset/thin-pens-push.md new file mode 100644 index 000000000..eaf93d529 --- /dev/null +++ b/.changeset/thin-pens-push.md @@ -0,0 +1,6 @@ +--- +"@ensembleui/react-kitchen-sink": patch +"@ensembleui/react-runtime": patch +--- + +enhance Button's label check before unwrapping it diff --git a/packages/runtime/src/widgets/Button.tsx b/packages/runtime/src/widgets/Button.tsx index ef7d2a704..40b6a7d68 100644 --- a/packages/runtime/src/widgets/Button.tsx +++ b/packages/runtime/src/widgets/Button.tsx @@ -13,7 +13,7 @@ import type { EnsembleWidgetProps, IconProps } from "../shared/types"; import { useEnsembleAction } from "../runtime/hooks/useEnsembleAction"; import { Icon } from "./Icon"; import { EnsembleRuntime } from "../runtime"; -import { isString } from "lodash-es"; +import { isObject } from "lodash-es"; const widgetName = "Button"; @@ -63,7 +63,7 @@ export const Button: React.FC = ({ id, onTap, ...rest }) => { const label = useMemo(() => { const rawLabel = values?.label; if (!rawLabel) return null; - if (isString(rawLabel)) return rawLabel; + if (!isObject(rawLabel)) return rawLabel; return EnsembleRuntime.render([unwrapWidget(rawLabel)]); }, [values?.label]);