MCPcopy
hub / github.com/sveltejs/svelte / depends_on

Function depends_on

packages/svelte/src/internal/client/reactivity/batch.js:1206–1226  ·  view source on GitHub ↗

* @param {Reaction} reaction * @param {Source[]} sources * @param {Map<Reaction, boolean>} checked

(reaction, sources, checked)

Source from the content-addressed store, hash-verified

1204 * @param {Map<Reaction, boolean>} checked
1205 */
1206function depends_on(reaction, sources, checked) {
1207 const depends = checked.get(reaction);
1208 if (depends !== undefined) return depends;
1209
1210 if (reaction.deps !== null) {
1211 for (const dep of reaction.deps) {
1212 if (includes.call(sources, dep)) {
1213 return true;
1214 }
1215
1216 if ((dep.f & DERIVED) !== 0 && depends_on(/** @type {Derived} */ (dep), sources, checked)) {
1217 checked.set(/** @type {Derived} */ (dep), true);
1218 return true;
1219 }
1220 }
1221 }
1222
1223 checked.set(reaction, false);
1224
1225 return false;
1226}
1227
1228/**
1229 * @param {Effect} effect

Callers 2

#commitMethod · 0.85
mark_effectsFunction · 0.85

Calls 2

setMethod · 0.65
getMethod · 0.45

Tested by

no test coverage detected