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]: Constants or properties named use* trigger compiler errors re: hooks #29900

Open
4 tasks
aaronmw opened this issue Jun 14, 2024 · 2 comments
Open
4 tasks
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@aaronmw
Copy link

aaronmw commented Jun 14, 2024

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/#N4Igzg9grgTgxgUxALhHCA7MAXABFMBAYQENCxcBeXAbQB0NdcByAcQgEsMBzXbCPgAsEuHBBgJmAGgZNmABQ5wA1l15QADkJGqAJmGmyWAdRLY4gtbgAqANWYMAugwbosebJbABJMAGUSADMEACEoPGpgIwJiMgQwZFojOQAjcKEOCkzcDAhsB0ZcZwwAXxcMBAAPDXE8XQRAkigAGzxAqAw4bA5MXABZAE8AQQ0NAAoASlwowolsWEYAHgA+ZOmY0nIAOgBbEnGNuKpl3DG1pkXdDgA3XGUEAcpgQ8IS1cKmT-XCTYQyj8+iwA9Fdru8vhMJv81sBPJlfAFgmFsFsXvFdvsxmjjqdzrhLjc7g8nmi3nimM8fnF-l8LiCbuDPpCafige9-iASkA

Repro steps

Try to reference an object or property with a name starting with use*. Seems it could at least narrow its scope to functions named use*?

How often does this bug happen?

Every time

What version of React are you using?

^19.0.0-rc-f994737d14-20240522

@aaronmw aaronmw added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Jun 14, 2024
@josephsavona
Copy link
Contributor

Thanks for posting. We could probably relax this, and not consider properties of potential hooks to be hooks unless they’re named that way.

@thedarshanpgowda
Copy link

i think just renaming useCases to just Cases will work as it doesnt cause any of the compile time errors.

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

No branches or pull requests

3 participants