@@ -273011,6 +273011,8 @@ let constantString ~loc str =
273011273011(* {} empty record *)
273012273012let emptyRecord ~loc = Exp.record ~loc [] None
273013273013
273014+ let unitExpr ~loc = Exp.construct ~loc (Location.mkloc (Lident "()") loc) None
273015+ 
273014273016let safeTypeFromValue valueStr =
273015273017  let valueStr = getLabel valueStr in
273016273018  if valueStr = "" || (valueStr.[0] [@doesNotRaise]) <> '_' then valueStr
@@ -273360,51 +273362,46 @@ let transformUppercaseCall3 ~config modulePath mapper jsxExprLoc callExprLoc
273360273362  match config.mode with
273361273363  (* The new jsx transform *)
273362273364  | "automatic" ->
273363-     let jsxExpr, key  =
273365+     let jsxExpr, keyAndUnit  =
273364273366      match (!childrenArg, keyProp) with
273365-       | None, (_, keyExpr)  :: _ ->
273367+       | None, key  :: _ ->
273366273368        ( Exp.ident
273367273369            {loc = Location.none; txt = Ldot (Lident "React", "jsxKeyed")},
273368-           [(nolabel, keyExpr )] )
273370+           [key;  (nolabel, unitExpr ~loc:Location.none )] )
273369273371      | None, [] ->
273370273372        (Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "jsx")}, [])
273371-       | Some _, (_, keyExpr)  :: _ ->
273373+       | Some _, key  :: _ ->
273372273374        ( Exp.ident
273373273375            {loc = Location.none; txt = Ldot (Lident "React", "jsxsKeyed")},
273374-           [(nolabel, keyExpr )] )
273376+           [key;  (nolabel, unitExpr ~loc:Location.none )] )
273375273377      | Some _, [] ->
273376273378        ( Exp.ident {loc = Location.none; txt = Ldot (Lident "React", "jsxs")},
273377273379          [] )
273378273380    in
273379-     Exp.apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ key )
273381+     Exp.apply ~attrs jsxExpr ([(nolabel, makeID); (nolabel, props)] @ keyAndUnit )
273380273382  | _ -> (
273381273383    match (!childrenArg, keyProp) with
273382-     | None, (_, keyExpr)  :: _ ->
273384+     | None, key  :: _ ->
273383273385      Exp.apply ~attrs
273384273386        (Exp.ident
273385273387           {
273386273388             loc = Location.none;
273387273389             txt = Ldot (Lident "React", "createElementWithKey");
273388273390           })
273389-         [(nolabel, makeID) ; (nolabel, props ); (nolabel, keyExpr )]
273391+         [key ; (nolabel, makeID ); (nolabel, props )]
273390273392    | None, [] ->
273391273393      Exp.apply ~attrs
273392273394        (Exp.ident
273393273395           {loc = Location.none; txt = Ldot (Lident "React", "createElement")})
273394273396        [(nolabel, makeID); (nolabel, props)]
273395-     | Some children, (_, keyExpr)  :: _ ->
273397+     | Some children, key  :: _ ->
273396273398      Exp.apply ~attrs
273397273399        (Exp.ident
273398273400           {
273399273401             loc = Location.none;
273400273402             txt = Ldot (Lident "React", "createElementVariadicWithKey");
273401273403           })
273402-         [
273403-           (nolabel, makeID);
273404-           (nolabel, props);
273405-           (nolabel, children);
273406-           (nolabel, keyExpr);
273407-         ]
273404+         [key; (nolabel, makeID); (nolabel, props); (nolabel, children)]
273408273405    | Some children, [] ->
273409273406      Exp.apply ~attrs
273410273407        (Exp.ident
@@ -273470,25 +273467,25 @@ let transformLowercaseCall3 ~config mapper jsxExprLoc callExprLoc attrs
273470273467    let keyProp =
273471273468      args |> List.filter (fun (arg_label, _) -> "key" = getLabel arg_label)
273472273469    in
273473-     let jsxExpr, key  =
273470+     let jsxExpr, keyAndUnit  =
273474273471      match (!childrenArg, keyProp) with
273475-       | None, (_, keyExpr)  :: _ ->
273472+       | None, key  :: _ ->
273476273473        ( Exp.ident
273477273474            {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxKeyed")},
273478-           [(nolabel, keyExpr )] )
273475+           [key;  (nolabel, unitExpr ~loc:Location.none )] )
273479273476      | None, [] ->
273480273477        ( Exp.ident {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsx")},
273481273478          [] )
273482-       | Some _, (_, keyExpr)  :: _ ->
273479+       | Some _, key  :: _ ->
273483273480        ( Exp.ident
273484273481            {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxsKeyed")},
273485-           [(nolabel, keyExpr )] )
273482+           [key;  (nolabel, unitExpr ~loc:Location.none )] )
273486273483      | Some _, [] ->
273487273484        ( Exp.ident {loc = Location.none; txt = Ldot (Lident "ReactDOM", "jsxs")},
273488273485          [] )
273489273486    in
273490273487    Exp.apply ~attrs jsxExpr
273491-       ([(nolabel, componentNameExpr); (nolabel, props)] @ key )
273488+       ([(nolabel, componentNameExpr); (nolabel, props)] @ keyAndUnit )
273492273489  | _ ->
273493273490    let children, nonChildrenProps =
273494273491      extractChildren ~loc:jsxExprLoc callArguments
0 commit comments