pull/16126/head
Rich Harris 3 months ago
parent b1f761c197
commit 4105d055f9

@ -138,7 +138,7 @@ export function VariableDeclaration(node, context) {
if (rune === '$state' && is_proxy) {
value = b.call('$.proxy', value);
if (dev) {
if (dev && !is_state) {
value = b.call('$.tag_proxy', value, b.literal(id.name));
}
}

@ -187,6 +187,8 @@ export function get_stack(label) {
*/
export function tag(source, label) {
source.label = label;
tag_proxy(source.v, label);
return source;
}

@ -12,7 +12,7 @@ import { state as source, set } from './reactivity/sources.js';
import { PROXY_PATH_SYMBOL, STATE_SYMBOL } from '#client/constants';
import { UNINITIALIZED } from '../../constants.js';
import * as e from './errors.js';
import { get_stack, tag, tag_proxy } from './dev/tracing.js';
import { get_stack, tag } from './dev/tracing.js';
import { tracing_mode_flag } from '../flags/index.js';
// TODO move all regexes into shared module?
@ -75,10 +75,7 @@ export function proxy(value) {
// rename all child sources and child proxies
for (const [prop, source] of sources) {
var label = get_label(path, prop);
tag(source, label);
tag_proxy(source.v, label);
tag(source, get_label(path, prop));
}
}
@ -165,9 +162,7 @@ export function proxy(value) {
var s = source(p, stack);
if (DEV) {
var label = get_label(path, prop);
tag(s, label);
tag_proxy(p, label);
tag(s, get_label(path, prop));
}
return s;
@ -225,9 +220,7 @@ export function proxy(value) {
var s = source(p, stack);
if (DEV) {
var label = get_label(path, prop);
tag(s, label);
tag_proxy(p, label);
tag(s, get_label(path, prop));
}
return s;
@ -281,23 +274,16 @@ export function proxy(value) {
return s;
});
sources.set(prop, s);
if (DEV) {
var label = get_label(path, prop);
tag(s, label);
tag_proxy(s.v, label);
tag(s, get_label(path, prop));
}
sources.set(prop, s);
}
} else {
has = s.v !== UNINITIALIZED;
var p = with_parent(() => proxy(value));
if (DEV) {
tag_proxy(p, get_label(path, prop));
}
set(s, p);
}

@ -141,7 +141,7 @@ export function set(source, value, should_proxy = false) {
let new_value = should_proxy ? proxy(value) : value;
if (DEV && should_proxy) {
if (DEV) {
tag_proxy(new_value, /** @type {string} */ (source.label));
}

Loading…
Cancel
Save