Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,23 @@ function is_signal_dirty(signal) {
*/
function execute_signal_fn(signal) {
const init = signal.i;
const flags = signal.f;
const previous_dependencies = current_dependencies;
const previous_dependencies_index = current_dependencies_index;
const previous_untracked_writes = current_untracked_writes;
const previous_consumer = current_consumer;
const previous_block = current_block;
const previous_component_context = current_component_context;
const previous_skip_consumer = current_skip_consumer;
const is_render_effect = (signal.f & RENDER_EFFECT) !== 0;
const is_render_effect = (flags & RENDER_EFFECT) !== 0;
const previous_untracking = current_untracking;
current_dependencies = /** @type {null | import('./types.js').Signal[]} */ (null);
current_dependencies_index = 0;
current_untracked_writes = null;
current_consumer = signal;
current_block = signal.b;
current_component_context = signal.x;
current_skip_consumer = !is_flushing_effect && (signal.f & UNOWNED) !== 0;
current_skip_consumer = !is_flushing_effect && (flags & UNOWNED) !== 0;
current_untracking = false;

// Render effects are invoked when the UI is about to be updated - run beforeUpdate at that point
Expand Down Expand Up @@ -412,6 +413,10 @@ function execute_signal_fn(signal) {
if (consumers === null) {
dependency.c = [signal];
} else if (consumers[consumers.length - 1] !== signal) {
// TODO: should this be:
//
// } else if (!consumers.includes(signal)) {
//
consumers.push(signal);
}
}
Expand Down Expand Up @@ -970,7 +975,7 @@ export function get(signal) {
) {
if (current_dependencies === null) {
current_dependencies = [signal];
} else if (signal !== current_dependencies[current_dependencies.length - 1]) {
} else {
current_dependencies.push(signal);
}
}
Expand Down