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

Function useThing

docs/pseudo.esm.sh/tinybase@9.0.0/ui-solid-inspector/index.js:122–129  ·  view source on GitHub ↗
(id2, offset)

Source from the content-addressed store, hash-verified

120 GLOBAL_CONTEXT[TINYBASE_CONTEXT]
121) : GLOBAL_CONTEXT[TINYBASE_CONTEXT] = createContext(EMPTY_CONTEXT_VALUE);
122var useThing = (id2, offset) => {
123 const contextValue = useContext(Context)?.value ?? EMPTY_CONTEXT$1;
124 return () => {
125 const resolvedContextValue = contextValue();
126 const resolvedId = getValue(id2);
127 return isUndefined(resolvedId) ? resolvedContextValue[offset * 2] : isString(resolvedId) ? objGet(resolvedContextValue[offset * 2 + 1], resolvedId) : resolvedId;
128 };
129};
130var useThingOrThingById = (thingOrThingId, offset) => {
131 const thing = useThing(thingOrThingId, offset);
132 return () => {

Callers 6

useThingOrThingByIdFunction · 0.70
useStoreFunction · 0.70
useMetricsFunction · 0.70
useIndexesFunction · 0.70
useRelationshipsFunction · 0.70
useQueriesFunction · 0.70

Calls 4

getValueFunction · 0.70
isUndefinedFunction · 0.70
isStringFunction · 0.70
objGetFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…