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;
inspect_effect(() => {
const value = deep_snapshot(get_value());
inspector(initial ? 'init' : 'update', ...value);
inspector(initial ? 'init' : 'update', ...deep_snapshot(get_value()));
initial = false;
});
}

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

@ -53,12 +53,6 @@ export interface Effect extends Reaction {
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 MaybeSource<T = unknown> = T | Source<T>;

@ -104,14 +104,6 @@ export function set_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 */
let current_version = 0;

Loading…
Cancel
Save