Skip to content
Source
Docs
Explore
Skills
MCP servers
For agents
Search or jump to…
Sign in
Sign up
TanStack
/
query
Pull requests
TanStack
query
Public
Synced with GitHub
Popular #10
Fork
0
0
0
0
1
2
3
4
5
6
7
8
9
Code
Architecture
Issues
Pull requests
Community
Assets
Artifacts
CI
Agents
Settings
refactor(query-core): simplify mutation scope lookup
#12686
Send to my agent
Merged
TkDodo
merged 1 commit into
query-v6
from
refs/pull/12686/head
·
merged by
TkDodo
last week
View on GitHub
Conversation
6
Commits
1
Files changed
2
Impact
Showing
2 changed files
with
20 additions
and
33 deletions
.
x
0 of 2 viewed, 2 left
Files
Hide whitespace
Unified
Split
5 additions and 0 deletions
+5
-0
.changeset/simpler-mutation-scope-lookup.md
Added
Diff
Before/After
Preview
Viewed
.changeset/simpler-mutation-scope-lookup.md
View file
@@ -0,0 +1,5 @@
1
+
---
2
+
'@tanstack/query-core': patch
3
+
---
4
+
5
+
Simplify mutation scope lookup and removal to reduce bundle size.
15 additions and 33 deletions
+15
-33
packages/query-core/src/mutationCache.ts
Modified
Diff
Before/After
Viewed
packages/query-core/src/mutationCache.ts
View file
Expand up
Show all 126 lines
@@ -127,7 +127,7 @@
127
127
*/
128
128
export
class
MutationCache
extends
Subscribable
<
MutationCacheListener
> {
129
129
#mutations:
Set
<
Mutation
<
any
,
any
,
any
,
any
>>
130
-
#scopes:
Map
<
string
,
Array
<
Mutation
<
any
,
any
,
any
,
any
>>>
130
+
#scopes:
Map
<
string
|
undefined
,
Array
<
Mutation
<
any
,
any
,
any
,
any
>>>
131
131
#mutationId:
number
132
132
133
133
constructor
(
public
config:
MutationCacheConfig
= {}) {
Expand up
Expand down
Show all 45 lines
@@ -179,15 +179,12 @@
179
179
if
(
this
.#mutations.
delete
(mutation)) {
180
180
mutation.
destroy
()
181
181
const
scope =
scopeFor
(mutation)
182
-
if
(
typeof
scope ===
'string'
) {
183
-
const
scopedMutations =
this
.#scopes.
get
(scope)
184
-
if
(scopedMutations) {
185
-
if
(scopedMutations.
length
>
1
) {
186
-
const
index = scopedMutations.
indexOf
(mutation)
187
-
if
(index !== -
1
) {
188
-
scopedMutations.
splice
(index,
1
)
189
-
}
Home
Search
Explore
Menu