Files
med-notes/.pnpm-store/v10/files/ea/1b206e7cb4a3bea8dad5fcfaa71392703fb3d8e738978e85d2a6541be2de9e56ecd215f25cd1c3238450462b1ce5d3670914d34eb29c838f27e4938d225684
2025-05-09 05:30:08 +02:00

28 lines
1.1 KiB
Plaintext

import { Derived } from './derived.cjs';
import { Store } from './store.cjs';
/**
* This is here to solve the pyramid dependency problem where:
* A
* / \
* B C
* \ /
* D
*
* Where we deeply traverse this tree, how do we avoid D being recomputed twice; once when B is updated, once when C is.
*
* To solve this, we create linkedDeps that allows us to sync avoid writes to the state until all of the deps have been
* resolved.
*
* This is a record of stores, because derived stores are not able to write values to, but stores are
*/
export declare const __storeToDerived: WeakMap<Store<unknown, (cb: unknown) => unknown>, Set<Derived<unknown, readonly any[]>>>;
export declare const __derivedToStore: WeakMap<Derived<unknown, readonly any[]>, Set<Store<unknown, (cb: unknown) => unknown>>>;
export declare const __depsThatHaveWrittenThisTick: {
current: Array<Derived<unknown> | Store<unknown>>;
};
/**
* @private only to be called from `Store` on write
*/
export declare function __flush(store: Store<unknown>): void;
export declare function batch(fn: () => void): void;