Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compiler Bug]: Compiler messes up with escape character #32123

Open
1 of 4 tasks
jgangel opened this issue Jan 19, 2025 · 1 comment · May be fixed by #32131
Open
1 of 4 tasks

[Compiler Bug]: Compiler messes up with escape character #32123

jgangel opened this issue Jan 19, 2025 · 1 comment · May be fixed by #32131
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@jgangel
Copy link

jgangel commented Jan 19, 2025

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-compiler (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://playground.react.dev/#N4Igzg9grgTgxgUxALhAgHgBwjALgAgBMEAzAQygBsCSoA7OXASwjvwFkBPAQU0wAoAlPmAAdNvjiswBVgGUoAIwC2TAgF58-BMPUA+EePzH8CAHSYYCAG4I6uACKkK1IQG4jJqXUiVzlCABzflEQBWVFNVwEQgBCUMEPCQBfJM8rXFg2EIljAB4SHGV8eSVVXHVgUpU1ZL1PE3w8pjpMKAJMMlxomDp1UNFRAHdQ-AB6etyTPMV23FZ8XE5MBH7wMrVQvQUa3Dyx2e7WScb9wphlE-xE8WTxEGSgA

Repro steps

Steps:

  1. Open playground link attached
  2. Expect the input element in JS tab to be <input pattern="\w" />, but it is <input pattern="\\w" /> instead, matching different regex than the one desired

How often does this bug happen?

Every time

What version of React are you using?

19.0.0

What version of React Compiler are you using?

19.0.0-beta-63e3235-20250105

@jgangel jgangel added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Jan 19, 2025
mofeiZ added a commit that referenced this issue Jan 19, 2025
Fall back to using JSXExpressionContainer for strings potentially containing escape sequences (a single backslash) to fix  #32123. This is an extension of #29079
mofeiZ added a commit that referenced this issue Jan 19, 2025
…l/generator

Repro for #32123

Note that this is only a bug when calling `@babel/generator:generate()` before transforming JSX.
@mofeiZ
Copy link
Contributor

mofeiZ commented Jan 19, 2025

Thanks for the report! This is due to a bug in @babel/generator (also see #29069 and #29120) and should be fixed by #32131.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants