File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
packages/babel-plugin-jsx/src Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -272,9 +272,12 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
272272 attributeValue || t . booleanLiteral ( true ) ,
273273 ) ) ;
274274 }
275- mergeArgs . push ( t . objectExpression ( dedupeProperties ( properties ) ) ) ;
276- properties = [ ] ;
277275 } else {
276+ if ( properties . length ) {
277+ mergeArgs . push ( t . objectExpression ( dedupeProperties ( properties ) ) ) ;
278+ properties = [ ] ;
279+ }
280+
278281 // JSXSpreadAttribute
279282 hasDynamicKeys = true ;
280283 transformJSXSpreadAttribute (
@@ -313,6 +316,9 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
313316 let propsExpression : t . Expression | t . ObjectProperty | t . Literal = t . nullLiteral ( ) ;
314317
315318 if ( mergeArgs . length ) {
319+ if ( properties . length ) {
320+ mergeArgs . push ( t . objectExpression ( dedupeProperties ( properties ) ) ) ;
321+ }
316322 if ( mergeArgs . length > 1 ) {
317323 propsExpression = t . callExpression (
318324 createIdentifier ( state , 'mergeProps' ) ,
@@ -322,6 +328,8 @@ const buildProps = (path: NodePath<t.JSXElement>, state: State) => {
322328 // single no need for a mergeProps call
323329 propsExpression = mergeArgs [ 0 ] ;
324330 }
331+ } else if ( properties . length ) {
332+ propsExpression = t . objectExpression ( dedupeProperties ( properties ) ) ;
325333 }
326334
327335 return {
You can’t perform that action at this time.
0 commit comments