Skip to content

Commit 5de3728

Browse files
committed
fix SSR string concatenation with comma issue
1 parent f4954fe commit 5de3728

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/index.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,14 @@ function renderTags(tags: Array<TagDescription>) {
243243
}"`
244244
)
245245
.join("");
246-
const children = tag.props.children;
246+
247+
let children = tag.props.children;
248+
// check if children is an array of strings
249+
// in Server Side Rendering, strings are concatenated with comma which is not what we want
250+
// we should join them manually instead
251+
if (Array.isArray(children) && children.every(child => typeof child === "string")) {
252+
children = children.join("");
253+
}
247254
if (tag.setting?.close) {
248255
return `<${tag.tag} data-sm="${tag.id}"${props}>${
249256
// @ts-expect-error

0 commit comments

Comments
 (0)