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

Tweak error message for "Should have a queue" #29626

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/react-reconciler/src/ReactFiberHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,7 +1260,8 @@ function updateReducerImpl<S, A>(

if (queue === null) {
throw new Error(
'Should have a queue. This is likely a bug in React. Please file an issue.',
'Should have a queue. You are likely calling Hooks conditionally, ' +
'which is not allowed. (https://react.dev/link/invalid-hook-call)',
);
}

Expand Down Expand Up @@ -1506,7 +1507,8 @@ function rerenderReducer<S, I, A>(

if (queue === null) {
throw new Error(
'Should have a queue. This is likely a bug in React. Please file an issue.',
'Should have a queue. You are likely calling Hooks conditionally, ' +
'which is not allowed. (https://react.dev/link/invalid-hook-call)',
);
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/error-codes/codes.json
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
"308": "Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().",
"309": "Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref",
"310": "Rendered more hooks than during the previous render.",
"311": "Should have a queue. This is likely a bug in React. Please file an issue.",
"311": "Should have a queue. You are likely calling Hooks conditionally, which is not allowed. (https://react.dev/link/invalid-hook-call)",
"312": "Rendered more hooks than during the previous render",
"313": "Unknown priority level. This error is likely caused by a bug in React. Please file an issue.",
"314": "Pinged unknown suspense boundary type. This is probably a bug in React.",
Expand Down