AUR0227
Error Message
AUR0227: Computed mutating
Description
This error occurs when a computed property attempts to modify (mutate) observable state during its computation. Computed properties should be pure functions that only read values and return a result without causing side effects or mutations.
Why This Matters
Computed properties are designed to be:
Pure: Only read values, never modify them
Deterministic: Always return the same result for the same inputs
Side-effect free: Don't trigger other state changes
When a computed property mutates state, it can cause:
Infinite update loops
Unpredictable behavior
Performance issues
Hard-to-debug race conditions
Common Scenarios
Direct Property Mutation
Array/Object Mutations
Observable Mutations
Solutions
1. Keep Computeds Pure
2. Use Non-Mutating Array Methods
3. Move Mutations to Methods or Effects
4. Use Effects for Side Effects
Example: Refactoring Problematic Code
Debugging Tips
Review Computed Logic: Ensure computed properties only read and calculate
Check for Assignments: Look for any
=assignments within computed gettersVerify Array Methods: Use non-mutating methods like
[...array].sort()instead ofarray.sort()Move Side Effects: Put mutations in methods, lifecycle hooks, or effects
Use DevTools: Monitor observable changes to identify unexpected mutations
Related Errors
Last updated
Was this helpful?