MCPcopy Index your code
hub / github.com/TanStack/query / remove

Method remove

packages/query-core/src/mutationCache.ts:137–158  ·  view source on GitHub ↗
(mutation: Mutation<any, any, any, any>)

Source from the content-addressed store, hash-verified

135 }
136
137 remove(mutation: Mutation<any, any, any, any>): void {
138 if (this.#mutations.delete(mutation)) {
139 const scope = scopeFor(mutation)
140 if (typeof scope === 'string') {
141 const scopedMutations = this.#scopes.get(scope)
142 if (scopedMutations) {
143 if (scopedMutations.length > 1) {
144 const index = scopedMutations.indexOf(mutation)
145 if (index !== -1) {
146 scopedMutations.splice(index, 1)
147 }
148 } else if (scopedMutations[0] === mutation) {
149 this.#scopes.delete(scope)
150 }
151 }
152 }
153 }
154
155 // Currently we notify the removal even if the mutation was already removed.
156 // Consider making this an error or not notifying of the removal depending on the desired semantics.
157 this.notify({ type: 'removed', mutation })
158 }
159
160 canRun(mutation: Mutation<any, any, any, any>): boolean {
161 const scope = scopeFor(mutation)

Callers

nothing calls this directly

Calls 3

notifyMethod · 0.95
scopeForFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected