Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/thin-pens-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ensembleui/react-kitchen-sink": patch
"@ensembleui/react-runtime": patch
---

enhance Button's label check before unwrapping it
4 changes: 2 additions & 2 deletions packages/runtime/src/widgets/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -63,7 +63,7 @@ export const Button: React.FC<ButtonProps> = ({ 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]);

Expand Down