@@ -273011,6 +273011,8 @@ let constantString ~loc str =
273011
273011
(* {} empty record *)
273012
273012
let emptyRecord ~loc = Exp.record ~loc [] None
273013
273013
273014
+ let unitExpr ~loc = Exp.construct ~loc (Location.mkloc (Lident "()") loc) None
273015
+
273014
273016
let safeTypeFromValue valueStr =
273015
273017
let valueStr = getLabel valueStr in
273016
273018
if valueStr = "" || (valueStr.[0] [@doesNotRaise]) <> '_' then valueStr
@@ -273360,51 +273362,46 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
273360
273362
match config.mode with
273361
273363
(* The new jsx transform *)
273362
273364
| "automatic" ->
273363
- let jsxExpr, key =
273365
+ let jsxExpr, keyAndUnit =
273364
273366
match (!childrenArg, keyProp) with
273365
- | None, (_, keyExpr) :: _ ->
273367
+ | None, key :: _ ->
273366
273368
( Exp.ident
273367
273369
{loc = Location.none; txt = Ldot (Lident "React", "jsxKeyed")},
273368
- [(nolabel, keyExpr )] )
273370
+ [key; (nolabel, unitExpr ~loc:Location.none )] )
273369
273371
| None, [] ->
273370
273372
(Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "jsx")}, [])
273371
- | Some _, (_, keyExpr) :: _ ->
273373
+ | Some _, key :: _ ->
273372
273374
( Exp.ident
273373
273375
{loc = Location.none; txt = Ldot (Lident "React", "jsxsKeyed")},
273374
- [(nolabel, keyExpr )] )
273376
+ [key; (nolabel, unitExpr ~loc:Location.none )] )
273375
273377
| Some _, [] ->
273376
273378
( Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "jsxs")},
273377
273379
[] )
273378
273380
in
273379
- Exp.apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ key )
273381
+ Exp.apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ keyAndUnit )
273380
273382
| _ -> (
273381
273383
match (!childrenArg, keyProp) with
273382
- | None, (_, keyExpr) :: _ ->
273384
+ | None, key :: _ ->
273383
273385
Exp.apply ~attrs
273384
273386
(Exp.ident
273385
273387
{
273386
273388
loc = Location.none;
273387
273389
txt = Ldot (Lident "React", "createElementWithKey");
273388
273390
})
273389
- [(nolabel, makeID) ; (nolabel, props ); (nolabel, keyExpr )]
273391
+ [key ; (nolabel, makeID ); (nolabel, props )]
273390
273392
| None, [] ->
273391
273393
Exp.apply ~attrs
273392
273394
(Exp.ident
273393
273395
{loc = Location.none; txt = Ldot (Lident "React", "createElement")})
273394
273396
[(nolabel, makeID); (nolabel, props)]
273395
- | Some children, (_, keyExpr) :: _ ->
273397
+ | Some children, key :: _ ->
273396
273398
Exp.apply ~attrs
273397
273399
(Exp.ident
273398
273400
{
273399
273401
loc = Location.none;
273400
273402
txt = Ldot (Lident "React", "createElementVariadicWithKey");
273401
273403
})
273402
- [
273403
- (nolabel, makeID);
273404
- (nolabel, props);
273405
- (nolabel, children);
273406
- (nolabel, keyExpr);
273407
- ]
273404
+ [key; (nolabel, makeID); (nolabel, props); (nolabel, children)]
273408
273405
| Some children, [] ->
273409
273406
Exp.apply ~attrs
273410
273407
(Exp.ident
@@ -273470,25 +273467,25 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
273470
273467
let keyProp =
273471
273468
args |> List.filter (fun (arg_label, _) -> "key" = getLabel arg_label)
273472
273469
in
273473
- let jsxExpr, key =
273470
+ let jsxExpr, keyAndUnit =
273474
273471
match (!childrenArg, keyProp) with
273475
- | None, (_, keyExpr) :: _ ->
273472
+ | None, key :: _ ->
273476
273473
( Exp.ident
273477
273474
{loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxKeyed")},
273478
- [(nolabel, keyExpr )] )
273475
+ [key; (nolabel, unitExpr ~loc:Location.none )] )
273479
273476
| None, [] ->
273480
273477
( Exp.ident {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsx")},
273481
273478
[] )
273482
- | Some _, (_, keyExpr) :: _ ->
273479
+ | Some _, key :: _ ->
273483
273480
( Exp.ident
273484
273481
{loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxsKeyed")},
273485
- [(nolabel, keyExpr )] )
273482
+ [key; (nolabel, unitExpr ~loc:Location.none )] )
273486
273483
| Some _, [] ->
273487
273484
( Exp.ident {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxs")},
273488
273485
[] )
273489
273486
in
273490
273487
Exp.apply ~attrs jsxExpr
273491
- ([(nolabel, componentNameExpr); (nolabel, props)] @ key )
273488
+ ([(nolabel, componentNameExpr); (nolabel, props)] @ keyAndUnit )
273492
273489
| _ ->
273493
273490
let children, nonChildrenProps =
273494
273491
extractChildren ~loc:jsxExprLoc callArguments
0 commit comments