@samitouri / QOS-React-2 / commits / 28e6a974fa

JSX: children which are jsx elements dont need expr container

Joe Savona committed Mar 31, 2023 at 12:32 UTC 28e6a974fadbb11c478d1c7b7a06fb446e11f3ca
5 files changed +16 -4
compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+4
@@ -955,6 +955,10 @@ function codegenJsxElement(
955 case "StringLiteral": {
956 return t.jsxText(value.value);
957 }
958 + case "JSXElement":
959 + case "JSXFragment": {
960 + return value;
961 + }
962 default: {
963 return t.jsxExpressionContainer(value);
964 }
compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md
+1 -1
@@ -31,7 +31,7 @@ function Component(props) {
31 }
32 t1 = (
33 <fbt desc={"Dialog to show to user"}>
34 - Hello {<fbt:param name={"user name"}>{t0}</fbt:param>}
34 + Hello <fbt:param name={"user name"}>{t0}</fbt:param>
35 </fbt>
36 );
37 $[0] = props.name;
compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md
+1 -1
@@ -22,7 +22,7 @@ function Component(props) {
22 if (c_0) {
23 t0 = (
24 <fbt desc={"Dialog to show to user"}>
25 - Hello {<fbt:param name={"user name"}>{props.name}</fbt:param>}
25 + Hello <fbt:param name={"user name"}>{props.name}</fbt:param>
26 </fbt>
27 );
28 $[0] = props.name;
compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md
+5 -1
@@ -28,7 +28,11 @@ function Component(props) {
28 if (c_0) {
29 const x = makeOptionalFunction(props);
30
31 - t0 = x?.(<div>{<span>{props.text}</span>}</div>);
31 + t0 = x?.(
32 + <div>
33 + <span>{props.text}</span>
34 + </div>
35 + );
36 $[0] = props;
37 $[1] = t0;
38 } else {
compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md
+5 -1
@@ -34,7 +34,11 @@ function Component(props) {
34 t0 = $[1];
35 }
36 const onChange = t0;
37 - return <form>{<input onChange={onChange} value={name} />}</form>;
37 + return (
38 + <form>
39 + <input onChange={onChange} value={name} />
40 + </form>
41 + );
42 }
43
44 ```