MCPcopy Create free account
hub / github.com/tinyplex/tinybase / mergeParentThings

Function mergeParentThings

src/ui-solid/Provider.tsx:30–44  ·  view source on GitHub ↗
(
  offset: Offset,
  parentValue: ContextValue,
  defaultThing: ThingsByOffset[Offset] | undefined,
  thingsById: ThingsById<ThingsByOffset>[Offset] | undefined,
  extraThingsById: ExtraThingsById,
)

Source from the content-addressed store, hash-verified

28export const OFFSET_SYNCHRONIZER = 7;
29
30const mergeParentThings = <Offset extends Offsets>(
31 offset: Offset,
32 parentValue: ContextValue,
33 defaultThing: ThingsByOffset[Offset] | undefined,
34 thingsById: ThingsById<ThingsByOffset>[Offset] | undefined,
35 extraThingsById: ExtraThingsById,
36): [ThingsByOffset[Offset] | undefined, ThingsById<ThingsByOffset>[Offset]] => [
37 defaultThing ??
38 (parentValue[offset * 2] as ThingsByOffset[Offset] | undefined),
39 {
40 ...parentValue[offset * 2 + 1],
41 ...thingsById,
42 ...extraThingsById[offset],
43 },
44];
45
46const EMPTY_CONTEXT = () => [] as ContextValue;
47

Callers 1

ProviderFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…