diff --git a/package.json b/package.json index d9d0573..0f4ab4d 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jsx-in-ttpg", "license": "UNLICENSE", - "version": "1.3.1", + "version": "1.3.2", "scripts": { "build": "tsup src/index.ts --format cjs,esm --dts --no-splitting", "clean": "rm -rf ./dist", diff --git a/src/index.ts b/src/index.ts index 2649cfc..d2126d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -775,6 +775,9 @@ const browserElement = (attrs: JSX.IntrinsicElements["browser"]) => { const switchElement = (attrs: JSX.IntrinsicElements["switch"], children?: Widget[]) => { const element = new WidgetSwitcher(); doCommon(element, attrs); + if (children) { + children.forEach(element.addChild); + } if (attrs.value) { if (attrs.value instanceof Widget) { element.setActiveWidget(attrs.value); @@ -782,9 +785,6 @@ const switchElement = (attrs: JSX.IntrinsicElements["switch"], children?: Widget element.setActiveIndex(attrs.value); } } - if (children) { - children.forEach(element.addChild); - } return element; };