-
Notifications
You must be signed in to change notification settings - Fork 49k
Open
Labels
Component: React CompilerStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug
Description
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
Repro steps
I have a hook called useWorker()
which creates and configures a WebWorker, returning it as a React.RefObject<Worker>
, while careful to never perform a side effect during a render.
The compiler fails to compile my code as written, but succeeds if I specify workerRef.current
as a dependency. But you're not supposed to express Ref.current
as a dependency, per the react-hooks/exhaustive-deps
linter:
React Hook
React.useCallback
has an unnecessary dependency:'workerRef.current'
. Either exclude it or remove the dependency array. Mutable values like'workerRef.current'
aren't valid dependencies because mutating them doesn't re-render the component. eslintreact-hooks/exhaustive-deps
How often does this bug happen?
Every time
What version of React are you using?
React Playground on 2024-05-17
Metadata
Metadata
Assignees
Labels
Component: React CompilerStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bugType: Bug