query icon indicating copy to clipboard operation
query copied to clipboard

Fix: Solid query `useIsMutating` throwing an error and `useMutationState` infinite loop

Open dev-rb opened this issue 3 months ago • 3 comments

  • Fixes an infinite loop in useMutationState caused by reading and writing to results in an effect.
  • Fixes useIsMutating throwing a reading properties of undefined error caused by reading isMutating of client which could be undefined in the case of some SSR environments/setups. This fix also makes it consistent with useMutationState where 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.

dev-rb avatar Sep 11 '25 17:09 dev-rb