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

Function is_dirty

packages/svelte/src/internal/client/runtime.js:153–191  ·  view source on GitHub ↗
(reaction)

Source from the content-addressed store, hash-verified

151 * @returns {boolean}
152 */
153export function is_dirty(reaction) {
154 var flags = reaction.f;
155
156 if ((flags & DIRTY) !== 0) {
157 return true;
158 }
159
160 if (flags & DERIVED) {
161 reaction.f &= ~WAS_MARKED;
162 }
163
164 if ((flags & MAYBE_DIRTY) !== 0) {
165 var dependencies = /** @type {Value[]} */ (reaction.deps);
166 var length = dependencies.length;
167
168 for (var i = 0; i < length; i++) {
169 var dependency = dependencies[i];
170
171 if (is_dirty(/** @type {Derived} */ (dependency))) {
172 update_derived(/** @type {Derived} */ (dependency));
173 }
174
175 if (dependency.wv > reaction.wv) {
176 return true;
177 }
178 }
179
180 if (
181 (flags & CONNECTED) !== 0 &&
182 // During time traveling we don't want to reset the status so that
183 // traversal of the graph in the other batches still happens
184 batch_values === null
185 ) {
186 set_signal_status(reaction, CLEAN);
187 }
188 }
189
190 return false;
191}
192
193/**
194 * @param {Value} signal

Callers 5

legacy_pre_effect_resetFunction · 0.90
#traverseMethod · 0.90
flush_queued_effectsFunction · 0.90
flush_eager_effectsFunction · 0.90
getFunction · 0.85

Calls 2

update_derivedFunction · 0.90
set_signal_statusFunction · 0.90

Tested by

no test coverage detected