query
query copied to clipboard
Fix: Solid query `useIsMutating` throwing an error and `useMutationState` infinite loop
- Fixes an infinite loop in
useMutationStatecaused by reading and writing toresultsin an effect. - Fixes
useIsMutatingthrowing areading properties of undefinederror caused by readingisMutatingofclientwhich could be undefined in the case of some SSR environments/setups. This fix also makes it consistent withuseMutationStatewhere the subscription is created inside of an effect
Summary by CodeRabbit
-
Bug Fixes
- More reliable mutation status updates that react correctly to changing inputs.
- Proper cleanup of subscriptions on component unmount or re-run, reducing potential leaks.
- Prevented stale data by resubscribing when relevant reactive sources change.
-
Performance
- Reduced unnecessary recalculations and renders by avoiding tracked reads during comparisons.
- More efficient equality checks to minimize redundant updates.
-
Refactor
- Improved reactivity management without altering the public API.