more tweaks

pull/14290/head
Dominic Gannaway 2 years ago
parent 0c8575f7cb
commit 3470d4dc22

@ -126,17 +126,22 @@ export function trace(fn, label, computed) {
var read_stack = ['read', get_stack()];
if (tracing_expression_reactive !== NOT_REACTIVE) {
var write_stack;
var set_stack;
if (signals.size === 1) {
write_stack = Array.from(signals)[0].stack;
set_stack = Array.from(signals)[0].stack;
}
var sub = null;
if (tracing_expressions.length !== 0) {
sub = tracing_expressions.slice();
tracing_expressions = [];
}
tracing_expressions.push({
changed: tracing_expression_reactive === REACTIVE_CHANGED,
label,
value,
time,
stacks: write_stack ? [read_stack, write_stack] : [read_stack],
sub: null
stacks: set_stack ? [read_stack, set_stack] : [read_stack],
sub
});
if (previously_tracing_expressions !== null) {

@ -24,6 +24,7 @@ import { equals, safe_equals } from './equality.js';
import * as e from '../errors.js';
import { destroy_effect } from './effects.js';
import { inspect_effects, set_inspect_effects } from './sources.js';
import { get_stack } from '../dev/tracing.js';
/**
* @template V
@ -56,6 +57,10 @@ export function derived(fn) {
parent: active_effect
};
if (DEV) {
signal.stack = ['created', get_stack()];
}
if (active_reaction !== null && (active_reaction.f & DERIVED) !== 0) {
var derived = /** @type {Derived} */ (active_reaction);
(derived.children ??= []).push(signal);

Loading…
Cancel
Save