MCPcopy Create free account
hub / github.com/Effect-TS/effect / fiberRefUnsafeMakePatch

Function fiberRefUnsafeMakePatch

packages/effect/src/internal/core.ts:1984–2006  ·  view source on GitHub ↗
(
  initial: Value,
  options: {
    readonly differ: Differ.Differ<Value, Patch>
    readonly fork: Patch
    readonly join?: ((oldV: Value, newV: Value) => Value) | undefined
  }
)

Source from the content-addressed store, hash-verified

1982
1983/** @internal */
1984export const fiberRefUnsafeMakePatch = <Value, Patch>(
1985 initial: Value,
1986 options: {
1987 readonly differ: Differ.Differ<Value, Patch>
1988 readonly fork: Patch
1989 readonly join?: ((oldV: Value, newV: Value) => Value) | undefined
1990 }
1991): FiberRef.FiberRef<Value> => {
1992 const _fiberRef = {
1993 ...CommitPrototype,
1994 [FiberRefTypeId]: fiberRefVariance,
1995 initial,
1996 commit() {
1997 return fiberRefGet(this)
1998 },
1999 diff: (oldValue: Value, newValue: Value) => options.differ.diff(oldValue, newValue),
2000 combine: (first: Patch, second: Patch) => options.differ.combine(first, second),
2001 patch: (patch: Patch) => (oldValue: Value) => options.differ.patch(patch, oldValue),
2002 fork: options.fork,
2003 join: options.join ?? ((_, n) => n)
2004 }
2005 return _fiberRef
2006}
2007
2008/** @internal */
2009export const fiberRefUnsafeMakeRuntimeFlags = (

Callers 5

fiberRefUnsafeMakeFunction · 0.85

Calls 3

diffMethod · 0.65
combineMethod · 0.65
patchMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…