From 07a6072ef77ffb8403786cf02538d2afc11f61f5 Mon Sep 17 00:00:00 2001 From: Peter Salas Date: Mon, 6 May 2024 14:38:35 -0700 Subject: [PATCH] Fix incorrect spread on children in jsx-runtime (#544) The built-in JSX runtime transformation already does this; doing it again has the effect of unwrapping single-element arrays. --- packages/ai-jsx/package.json | 2 +- packages/ai-jsx/src/jsx-runtime.ts | 3 +-- packages/docs/docs/changelog.md | 6 +++++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/ai-jsx/package.json b/packages/ai-jsx/package.json index 4d94cd1b0..c4823e567 100644 --- a/packages/ai-jsx/package.json +++ b/packages/ai-jsx/package.json @@ -4,7 +4,7 @@ "repository": "fixie-ai/ai-jsx", "bugs": "https://github.com/fixie-ai/ai-jsx/issues", "homepage": "https://ai-jsx.com", - "version": "0.30.2", + "version": "0.31.0", "volta": { "extends": "../../package.json" }, diff --git a/packages/ai-jsx/src/jsx-runtime.ts b/packages/ai-jsx/src/jsx-runtime.ts index 21d8bf3d0..00ca8fbff 100644 --- a/packages/ai-jsx/src/jsx-runtime.ts +++ b/packages/ai-jsx/src/jsx-runtime.ts @@ -13,8 +13,7 @@ export declare namespace JSX { /** @hidden */ export function jsx(type: any, config: any, maybeKey?: any) { const configWithKey = maybeKey !== undefined ? { ...config, key: maybeKey } : config; - const children = config && Array.isArray(config.children) ? config.children : []; - return AI.createElement(type, configWithKey, ...children); + return AI.createElement(type, configWithKey); } /** @hidden */ export const jsxDEV = jsx; diff --git a/packages/docs/docs/changelog.md b/packages/docs/docs/changelog.md index 5c5678c19..cbce2b71f 100644 --- a/packages/docs/docs/changelog.md +++ b/packages/docs/docs/changelog.md @@ -1,6 +1,10 @@ # Changelog -## 0.30.2 +## 0.31.0 + +- Fix incorrect unwrapping of JSX array `children`. + +## [0.30.2](https://github.com/fixie-ai/ai-jsx/tree/29071540b051a7a6db2b7986bc544debde82298a) - Fix double Anthropic requests