-
Notifications
You must be signed in to change notification settings - Fork 47.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react-compiler):
JSXText
emits incorrect with bracket
- Loading branch information
Showing
5 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
...r/apps/playground/__tests__/e2e/__snapshots__/page.spec.ts/bracket-in-jsx-text-output.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { c as _c } from "react/compiler-runtime"; // | ||
@compilationMode(all) | ||
function Component() { | ||
const $ = _c(1); | ||
let t0; | ||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) { | ||
t0 = <div>{"Hello, {world}!"}</div>; | ||
$[0] = t0; | ||
} else { | ||
t0 = $[0]; | ||
} | ||
return t0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...lugin-react-compiler/src/__tests__/fixtures/compiler/descriptive-name.expect.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
## Input | ||
|
||
```javascript | ||
function Test() { | ||
return ( | ||
<div> | ||
If the string contains the string {pageNumber} it will be | ||
replaced by the page number. | ||
</div> | ||
); | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Test, | ||
params: [], | ||
}; | ||
|
||
``` | ||
|
||
## Code | ||
|
||
```javascript | ||
import { c as _c } from "react/compiler-runtime"; | ||
function Test() { | ||
const $ = _c(1); | ||
let t0; | ||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) { | ||
t0 = ( | ||
<div> | ||
{ | ||
"If the string contains the string {pageNumber} it will be replaced by the page number." | ||
} | ||
</div> | ||
); | ||
$[0] = t0; | ||
} else { | ||
t0 = $[0]; | ||
} | ||
return t0; | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Test, | ||
params: [], | ||
}; | ||
|
||
``` | ||
### Eval output | ||
(kind: ok) <div>If the string contains the string {pageNumber} it will be replaced by the page number.</div> |
13 changes: 13 additions & 0 deletions
13
...packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/descriptive-name.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function Test() { | ||
return ( | ||
<div> | ||
If the string contains the string {pageNumber} it will be | ||
replaced by the page number. | ||
</div> | ||
); | ||
} | ||
|
||
export const FIXTURE_ENTRYPOINT = { | ||
fn: Test, | ||
params: [], | ||
}; |