Skip to content

Commit

Permalink
Fix incorrect spread on children in jsx-runtime (#544)
Browse files Browse the repository at this point in the history
The built-in JSX runtime transformation already does this; doing it
again has the effect of unwrapping single-element arrays.
  • Loading branch information
petersalas authored May 6, 2024
1 parent 2907154 commit 07a6072
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ai-jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/ai-jsx/src/jsx-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion packages/docs/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 07a6072

Please sign in to comment.