From 152b0a78b6ba18442f38164ce90789bc243f6e00 Mon Sep 17 00:00:00 2001 From: Simon Holzmayer Date: Sat, 28 Oct 2023 12:20:38 +0200 Subject: [PATCH] fix: typeerror when clsx str is undefined (#967) * fix: typeerror when clsx str is undefined * docs: add changeset --------- Co-authored-by: Segun Adebayo --- .changeset/wet-plants-flash.md | 5 +++++ packages/core/src/merge-props.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/wet-plants-flash.md diff --git a/.changeset/wet-plants-flash.md b/.changeset/wet-plants-flash.md new file mode 100644 index 0000000000..1da4acb7dd --- /dev/null +++ b/.changeset/wet-plants-flash.md @@ -0,0 +1,5 @@ +--- +"@zag-js/core": patch +--- + +Fix issue where mergeProps throws when className str is undefined diff --git a/packages/core/src/merge-props.ts b/packages/core/src/merge-props.ts index 74c19d1d49..87e1f15b9c 100644 --- a/packages/core/src/merge-props.ts +++ b/packages/core/src/merge-props.ts @@ -6,7 +6,7 @@ interface Props { const clsx = (...args: (string | undefined)[]) => args - .map((str) => str?.trim()) + .map((str) => str?.trim?.()) .filter(Boolean) .join(" ")