@mocanvas/store · type

CreateComputedCacheOpts

type CreateComputedCacheOpts<Result, R extends UnknownRecord = UnknownRecord> = CreateComputedCacheOptions<Result> & {
    /**
     * Treat two versions of the *record* as the same, so the derivation is not
     * re-run when only parts it does not read have changed.
     *
     * `isEqual` compares results and can only save the dependents work;
     * `areRecordsEqual` compares inputs and saves the derivation itself. Use it
     * when the derivation is expensive and reads only a couple of fields —
     * geometry from `props`, say, which should not be rebuilt because the shape
     * moved.
     */
    areRecordsEqual?: ((a: R, b: R) => boolean) | undefined;
}

Options for createComputedCache, including the record-level equality that decides when a derivation is worth re-running at all.

Mentioned here

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.