Skip to content

refactor(core): unify removeEffectFromSubscribers() and removeStaleSubscribers() #124

@nerdalytics

Description

@nerdalytics

DUP-007

removeEffectFromSubscribers() (lines 822–828) is removeStaleSubscribers() (lines 883–888) with the filter predicate always-true:

// removeStaleSubscribers
for (const dep of prevDeps) {
    if (!newDeps.has(dep)) {
        findSubscribers(dep)?.delete(eff)
    }
}

// removeEffectFromSubscribers
for (const dep of deps) {
    findSubscribers(dep)?.delete(eff)
}

The iteration body is identical. removeStaleSubscribers could accept an optional exclude set, and removeEffectFromSubscribers becomes a call with no exclusion. Alternatively, removeEffectFromSubscribers could call removeStaleSubscribers with an empty set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions