MCPcopy
hub / github.com/vuejs/core / cleanupDeps

Function cleanupDeps

packages/reactivity/src/effect.ts:324–351  ·  view source on GitHub ↗
(sub: Subscriber)

Source from the content-addressed store, hash-verified

322}
323
324function cleanupDeps(sub: Subscriber) {
325 // Cleanup unused deps
326 let head
327 let tail = sub.depsTail
328 let link = tail
329 while (link) {
330 const prev = link.prevDep
331 if (link.version === -1) {
332 if (link === tail) tail = prev
333 // unused - remove it from the dep's subscribing effect list
334 removeSub(link)
335 // also remove it from this effect's dep list
336 removeDep(link)
337 } else {
338 // The new head is the last node seen which wasn't removed
339 // from the doubly-linked list
340 head = link
341 }
342
343 // restore previous active link if any
344 link.dep.activeLink = link.prevActiveLink
345 link.prevActiveLink = undefined
346 link = prev
347 }
348 // set the new head & tail
349 sub.deps = head
350 sub.depsTail = tail
351}
352
353function isDirty(sub: Subscriber): boolean {
354 for (let link = sub.deps; link; link = link.nextDep) {

Callers 2

runMethod · 0.85
refreshComputedFunction · 0.85

Calls 2

removeSubFunction · 0.85
removeDepFunction · 0.85

Tested by

no test coverage detected