Home / Function/ mark_reactions() — svelte Function Reference

mark_reactions() — svelte Function Reference

Architecture documentation for the mark_reactions() function in sources.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  b81807e3_a940_6fda_f1f2_243d04126552["mark_reactions()"]
  e5c35d51_28d8_9054_923d_b7f82a3c8dc2["sources.js"]
  b81807e3_a940_6fda_f1f2_243d04126552 -->|defined in| e5c35d51_28d8_9054_923d_b7f82a3c8dc2
  fc566ca0_2101_ea1a_cf42_44d2442cc526["internal_set()"]
  fc566ca0_2101_ea1a_cf42_44d2442cc526 -->|calls| b81807e3_a940_6fda_f1f2_243d04126552
  ad360ec3_c98b_ac47_212b_923d0363a0ce["is_runes()"]
  b81807e3_a940_6fda_f1f2_243d04126552 -->|calls| ad360ec3_c98b_ac47_212b_923d0363a0ce
  6479f832_c1d7_7636_b658_b3f9c70d9af0["set_signal_status()"]
  b81807e3_a940_6fda_f1f2_243d04126552 -->|calls| 6479f832_c1d7_7636_b658_b3f9c70d9af0
  e3c23578_a277_4ec0_656f_1000b1fa503b["schedule_effect()"]
  b81807e3_a940_6fda_f1f2_243d04126552 -->|calls| e3c23578_a277_4ec0_656f_1000b1fa503b
  style b81807e3_a940_6fda_f1f2_243d04126552 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/src/internal/client/reactivity/sources.js lines 322–370

function mark_reactions(signal, status) {
	var reactions = signal.reactions;
	if (reactions === null) return;

	var runes = is_runes();
	var length = reactions.length;

	for (var i = 0; i < length; i++) {
		var reaction = reactions[i];
		var flags = reaction.f;

		// In legacy mode, skip the current effect to prevent infinite loops
		if (!runes && reaction === active_effect) continue;

		// Inspect effects need to run immediately, so that the stack trace makes sense
		if (DEV && (flags & EAGER_EFFECT) !== 0) {
			eager_effects.add(reaction);
			continue;
		}

		var not_dirty = (flags & DIRTY) === 0;

		// don't set a DIRTY reaction to MAYBE_DIRTY
		if (not_dirty) {
			set_signal_status(reaction, status);
		}

		if ((flags & DERIVED) !== 0) {
			var derived = /** @type {Derived} */ (reaction);

			batch_values?.delete(derived);

			if ((flags & WAS_MARKED) === 0) {
				// Only connected deriveds can be reliably unmarked right away
				if (flags & CONNECTED) {
					reaction.f |= WAS_MARKED;
				}

				mark_reactions(derived, MAYBE_DIRTY);
			}
		} else if (not_dirty) {
			if ((flags & BLOCK_EFFECT) !== 0 && eager_block_effects !== null) {
				eager_block_effects.add(/** @type {Effect} */ (reaction));
			}

			schedule_effect(/** @type {Effect} */ (reaction));
		}
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does mark_reactions() do?
mark_reactions() is a function in the svelte codebase, defined in packages/svelte/src/internal/client/reactivity/sources.js.
Where is mark_reactions() defined?
mark_reactions() is defined in packages/svelte/src/internal/client/reactivity/sources.js at line 322.
What does mark_reactions() call?
mark_reactions() calls 3 function(s): is_runes, schedule_effect, set_signal_status.
What calls mark_reactions()?
mark_reactions() is called by 1 function(s): internal_set.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free