add comments, minor tweak

pull/16060/head
ComputerGuy 4 months ago
parent 115384c707
commit 3bbabafa5a

@ -22,8 +22,12 @@ export const HEAD_EFFECT = 1 << 19;
export const EFFECT_HAS_DERIVED = 1 << 20;
export const EFFECT_IS_UPDATING = 1 << 21;
// `$inspect.trace` proxy path flags
/** Keep path the same */
export const PROXY_PRESERVE_PATH = 1 << 1;
/** Change proxy path to new "owner" */
export const PROXY_CHANGE_PATH = 1 << 2;
/** "Unown" proxy, so its path becomes `[$state proxy]` */
export const PROXY_REMOVE_PATH = 1 << 3;
export const STATE_SYMBOL = Symbol('$state');

@ -95,9 +95,11 @@ export function trace(label, fn) {
var previously_tracing_expressions = tracing_expressions;
try {
tracing_expressions = { entries: new Map(), reaction: active_reaction };
var start = performance.now();
var value = fn();
var time = (performance.now() - start).toFixed(2);
if (!effect_tracking()) {
// eslint-disable-next-line no-console
console.log(`${label()} %cran outside of an effect (${time}ms)`, 'color: grey');

Loading…
Cancel
Save