MCPcopy Index your code
hub / github.com/tinyplex/tinybase / useProvideThing

Function useProvideThing

src/ui-react/context.ts:103–113  ·  view source on GitHub ↗
(
  thingId: Id,
  thing: ThingsByOffset[Offset],
  offset: Offset,
)

Source from the content-addressed store, hash-verified

101};
102
103export const useProvideThing = <Offset extends Offsets>(
104 thingId: Id,
105 thing: ThingsByOffset[Offset],
106 offset: Offset,
107): void => {
108 const {16: addExtraThingById, 17: delExtraThingById} = useContext(Context);
109 useEffect(() => {
110 addExtraThingById?.(offset, thingId, thing);
111 return () => delExtraThingById?.(offset, thingId);
112 }, [addExtraThingById, thingId, thing, offset, delExtraThingById]);
113};
114
115export const useThingIds = (offset: Offsets): Ids =>
116 objIds((useContext(Context)[offset * 2 + 1] ?? {}) as IdObj<unknown>);

Callers 8

useProvideStoreFunction · 0.90
useProvideMetricsFunction · 0.90
useProvideIndexesFunction · 0.90
useProvideRelationshipsFunction · 0.90
useProvideQueriesFunction · 0.90
useProvideCheckpointsFunction · 0.90
useProvidePersisterFunction · 0.90
useProvideSynchronizerFunction · 0.90

Calls 2

addExtraThingByIdFunction · 0.50
delExtraThingByIdFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…