-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
docs: fix mutation status type #9595
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
Conversation
WalkthroughDocumentation for React useMutation updated: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/framework/react/reference/useMutation.md (1)
144-145
: Terminology bug: “query” → “mutation”.This is the mutation reference; “query” here is misleading.
- - The error object for the query, if an error was encountered. + - The error object for the mutation, if an error was encountered.
🧹 Nitpick comments (3)
docs/framework/react/reference/useMutation.md (3)
131-137
: Minor clarity tweak: mention reset() returns status to idle.Adding this one-liner helps users reason about state transitions around retries and manual resets.
- `status: MutationStatus` - Will be: - `idle` initial status prior to the mutation function executing. - `pending` if the mutation is currently executing. - `error` if the last mutation attempt resulted in an error. - `success` if the last mutation attempt was successful. + - Resets to `idle` after calling `reset()`.
141-143
: Type accuracy: data should be TData | undefined, not unknown.The hook is generic over TData, and the resolved data is typed accordingly. Documenting it as unknown drops type information.
-- `data: undefined | unknown` +- `data: undefined | TData` - Defaults to `undefined` - The last successfully resolved data for the mutation.
113-116
: Clarify when variables are optional.In TypeScript, variables are only truly optional if TVariables allows undefined/void. This avoids confusion when TVariables is non-optional.
- - `variables: TVariables` - - Optional - - The variables object to pass to the `mutationFn`. + - `variables: TVariables` + - Optional if `TVariables` allows `undefined`/`void`; otherwise required + - The variables object to pass to the `mutationFn`.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/framework/react/reference/useMutation.md
(1 hunks)
🔇 Additional comments (1)
docs/framework/react/reference/useMutation.md (1)
131-137
: Good correction: status should be MutationStatus (idle | pending | error | success).The change aligns the docs with the actual union type and the derived booleans. Looks correct.
View your CI Pipeline Execution ↗ for commit 5565a87
☁️ Nx Cloud last updated this comment at |
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/framework/react/reference/useMutation.md (1)
141-145
: Update useMutation docs: correct data type & wordingVerified: mutation result uses data: TData | undefined and error: TError | null — docs should reflect that. Location: docs/framework/react/reference/useMutation.md (lines 141–145)
-
data: undefined | unknown
+data: TData | undefined
- The error object for the query, if an error was encountered.
- The error object for the mutation, if an error was encountered.
🧹 Nitpick comments (4)
docs/framework/react/reference/useMutation.md (4)
87-87
: Grammar nit: article before “number”Use “a number”, not “an number”.
- - If set to an `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number. + - If set to a `number`, e.g. `3`, failed mutations will retry until the failed mutations count meets that number.
81-81
: Wording: “fetched” is query terminologyFor mutations, prefer “succeeded”. Same below in Returns/onSettled.
- - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error + - This function will fire when the mutation either succeeds or encounters an error and will be passed either the data or error
126-126
: Mirror the onSettled wording fix in ReturnsKeep terminology consistent with the Options section.
- - This function will fire when the mutation is either successfully fetched or encounters an error and be passed either the data or error + - This function will fire when the mutation either succeeds or encounters an error and will be passed either the data or error
131-131
: Optional: cross-link MutationStatusIf there’s a central types section, link
MutationStatus
to improve discoverability (e.g., a types page or source link).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
docs/framework/react/reference/useMutation.md
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Test
🔇 Additional comments (1)
docs/framework/react/reference/useMutation.md (1)
131-137
: Verified MutationStatus and derived booleans
MutationStatus is defined exactly as'idle' | 'pending' | 'success' | 'error'
, and mutation code only usesisIdle
,isPending
,isSuccess
, andisError
with no lingeringloading
state. Docs now accurately reflect the implementation.
Summary
This PR fixes the
status
type in mutation documentationChanges
Update type definition
status: string
status: MutationStatus
Why
Summary by CodeRabbit