Commit a1ed746
committed
fix(shop): isMutating check === 1 per TkDodo's concurrent pattern
At onSettled time, React Query v5 still counts the current mutation as
in-flight. The check should be === 1 ("I'm the only one left"), not
=== 0 ("everyone has finished"). Also returns the invalidation promise
so the mutation stays isPending until the background refetch finishes.
Reference: tkdodo.eu/blog/concurrent-optimistic-updates-in-react-query1 parent d52afbd commit a1ed746
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
37 | 42 | | |
38 | 43 | | |
39 | 44 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
0 commit comments