Merge branch 'simplify-inspect' into non-recursive-mark-reactions

pull/12069/head
Rich Harris 5 months ago
commit c9482c733b

@ -13,8 +13,7 @@ export function inspect(get_value, inspector = console.log) {
let initial = true; let initial = true;
inspect_effect(() => { inspect_effect(() => {
const value = deep_snapshot(get_value()); inspector(initial ? 'init' : 'update', ...deep_snapshot(get_value()));
inspector(initial ? 'init' : 'update', ...value);
initial = false; initial = false;
}); });
} }

@ -23,21 +23,18 @@ import * as e from '../errors.js';
/** /**
* @template V * @template V
* @param {V} value * @param {V} v
* @returns {import('#client').Source<V>} * @returns {import('#client').Source<V>}
*/ */
/*#__NO_SIDE_EFFECTS__*/ /*#__NO_SIDE_EFFECTS__*/
export function source(value) { export function source(v) {
/** @type {import('#client').Source<V>} */ return {
const source = {
f: 0, // TODO ideally we could skip this altogether, but it causes type errors f: 0, // TODO ideally we could skip this altogether, but it causes type errors
v,
reactions: null, reactions: null,
equals: equals, equals,
v: value,
version: 0 version: 0
}; };
return source;
} }
/** /**

@ -53,12 +53,6 @@ export interface Effect extends Reaction {
component_function?: any; component_function?: any;
} }
export interface ValueDebug<V = unknown> extends Value<V> {
inspect: Set<Function>;
}
export interface DerivedDebug<V = unknown> extends Derived<V>, ValueDebug<V> {}
export type Source<V = unknown> = Value<V>; export type Source<V = unknown> = Value<V>;
export type MaybeSource<T = unknown> = T | Source<T>; export type MaybeSource<T = unknown> = T | Source<T>;

@ -104,14 +104,6 @@ export function set_current_untracked_writes(value) {
current_untracked_writes = value; current_untracked_writes = value;
} }
/** @type {null | import('#client').ValueDebug} */
export let last_inspected_signal = null;
/** @param {null | import('#client').ValueDebug} signal */
export function set_last_inspected_signal(signal) {
last_inspected_signal = signal;
}
/** @type {number} Used by sources and deriveds for handling updates to unowned deriveds */ /** @type {number} Used by sources and deriveds for handling updates to unowned deriveds */
let current_version = 0; let current_version = 0;

Loading…
Cancel
Save