this code doesn't appear to do anything useful, and no tests fail without it

pull/16131/head
Rich Harris 3 months ago
parent 4616259ec9
commit 3085d5d3e2

@ -20,23 +20,6 @@ function log_entry(signal, traces = []) {
return;
}
if (signal.trace) {
var previous_captured_signals = captured_signals;
var captured = new Set();
set_captured_signals(captured);
try {
untrack(signal.trace);
} finally {
set_captured_signals(previous_captured_signals);
}
if (captured.size > 0) {
for (const dep of captured) log_entry(dep);
return;
}
}
const type = (signal.f & DERIVED) !== 0 ? '$derived' : '$state';
const current_reaction = /** @type {Reaction} */ (active_reaction);
const dirty = signal.wv > current_reaction.wv || current_reaction.wv === 0;

@ -524,16 +524,6 @@ function create_item(
var v = reactive ? (mutable ? mutable_source(value) : source(value)) : value;
var i = (flags & EACH_INDEX_REACTIVE) === 0 ? index : source(index);
if (DEV && reactive) {
// For tracing purposes, we need to link the source signal we create with the
// collection + index so that tracing works as intended
/** @type {Value} */ (v).trace = () => {
var collection_index = typeof i === 'number' ? index : i.v;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
get_collection()[collection_index];
};
}
/** @type {EachItem} */
var item = {
i,

@ -66,7 +66,6 @@ export function source(v, stack) {
if (DEV && tracing_mode_flag) {
signal.created = stack ?? get_stack('CreatedAt');
signal.trace = null;
}
return signal;

@ -22,7 +22,6 @@ export interface Value<V = unknown> extends Signal {
updated?: Error | null;
trace_need_increase?: boolean;
trace_v?: V;
trace?: null | (() => void);
}
export interface Reaction extends Signal {

@ -779,26 +779,21 @@ export function get(signal) {
active_reaction !== null &&
tracing_expressions.reaction === active_reaction
) {
// Used when mapping state between special blocks like `each`
if (signal.trace) {
signal.trace();
} else {
var trace = get_stack('TracedAt');
var trace = get_stack('TracedAt');
if (trace) {
var traces = tracing_expressions.entries.get(signal);
if (trace) {
var traces = tracing_expressions.entries.get(signal);
if (traces === undefined) {
tracing_expressions.entries.set(signal, (traces = []));
}
if (traces === undefined) {
tracing_expressions.entries.set(signal, (traces = []));
}
var last = traces.at(-1);
var last = traces.at(-1);
// traces can be duplicated, e.g. by `snapshot` invoking both
// both `getOwnPropertyDescriptor` and `get` traps at once
if (trace.stack !== last?.stack) {
traces.push(trace);
}
// traces can be duplicated, e.g. by `snapshot` invoking both
// both `getOwnPropertyDescriptor` and `get` traps at once
if (trace.stack !== last?.stack) {
traces.push(trace);
}
}
}

Loading…
Cancel
Save