mutate() — react Function Reference
Architecture documentation for the mutate() function in InferMutationAliasingEffects.ts from the react codebase.
Entity Profile
Dependency Diagram
graph TD 3338dc96_fe73_47e6_7c7f_3a784c17be89["mutate()"] 7f9a06c8_8e18_76fc_0edd_1f0d608aae44["InferenceState"] 3338dc96_fe73_47e6_7c7f_3a784c17be89 -->|defined in| 7f9a06c8_8e18_76fc_0edd_1f0d608aae44 7cb90dd3_dbe0_0087_670d_277ddeadabfc["applyEffect()"] 7cb90dd3_dbe0_0087_670d_277ddeadabfc -->|calls| 3338dc96_fe73_47e6_7c7f_3a784c17be89 8f06f55e_0851_0d44_0a89_d6dee31fdbb5["kind()"] 3338dc96_fe73_47e6_7c7f_3a784c17be89 -->|calls| 8f06f55e_0851_0d44_0a89_d6dee31fdbb5 d7fde76c_4fd9_feb3_299b_798689f05bc6["assertExhaustive()"] 3338dc96_fe73_47e6_7c7f_3a784c17be89 -->|calls| d7fde76c_4fd9_feb3_299b_798689f05bc6 style 3338dc96_fe73_47e6_7c7f_3a784c17be89 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingEffects.ts lines 1477–1531
mutate(
variant:
| 'Mutate'
| 'MutateConditionally'
| 'MutateTransitive'
| 'MutateTransitiveConditionally',
place: Place,
): 'none' | 'mutate' | 'mutate-frozen' | 'mutate-global' | 'mutate-ref' {
if (isRefOrRefValue(place.identifier)) {
return 'mutate-ref';
}
const kind = this.kind(place).kind;
switch (variant) {
case 'MutateConditionally':
case 'MutateTransitiveConditionally': {
switch (kind) {
case ValueKind.Mutable:
case ValueKind.Context: {
return 'mutate';
}
default: {
return 'none';
}
}
}
case 'Mutate':
case 'MutateTransitive': {
switch (kind) {
case ValueKind.Mutable:
case ValueKind.Context: {
return 'mutate';
}
case ValueKind.Primitive: {
// technically an error, but it's not React specific
return 'none';
}
case ValueKind.Frozen: {
return 'mutate-frozen';
}
case ValueKind.Global: {
return 'mutate-global';
}
case ValueKind.MaybeFrozen: {
return 'mutate-frozen';
}
default: {
assertExhaustive(kind, `Unexpected kind ${kind}`);
}
}
}
default: {
assertExhaustive(variant, `Unexpected mutation variant ${variant}`);
}
}
}
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does mutate() do?
mutate() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingEffects.ts.
Where is mutate() defined?
mutate() is defined in compiler/packages/babel-plugin-react-compiler/src/Inference/InferMutationAliasingEffects.ts at line 1477.
What does mutate() call?
mutate() calls 2 function(s): assertExhaustive, kind.
What calls mutate()?
mutate() is called by 1 function(s): applyEffect.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free