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

Function load

docs/pseudo.esm.sh/tinybase@9.0.0/ui-react-inspector/index.js:1196–1229  ·  view source on GitHub ↗
(initialContent)

Source from the content-addressed store, hash-verified

1194 }
1195 };
1196 const load = async (initialContent) => {
1197 if (status != 2) {
1198 setStatus(
1199 1
1200 /* Loading */
1201 );
1202 loads++;
1203 await schedule(async () => {
1204 await tryCatch(
1205 async () => {
1206 const content = await getPersisted();
1207 if (isArray2(content)) {
1208 setContentOrChanges(content);
1209 } else if (isUndefined2(content) && initialContent) {
1210 setDefaultContent(initialContent);
1211 } else if (!isUndefined2(content)) {
1212 errorNew(`Content is not an array: ${content}`);
1213 }
1214 },
1215 (error) => {
1216 if (initialContent) {
1217 setDefaultContent(initialContent);
1218 }
1219 }
1220 );
1221 setStatus(
1222 0
1223 /* Idle */
1224 );
1225 await saveAfterMutated();
1226 });
1227 }
1228 return persister;
1229 };
1230 const startAutoLoad = async (initialContent) => {
1231 stopAutoLoad();
1232 await load(initialContent);

Callers 1

startAutoLoadFunction · 0.70

Calls 10

setStatusFunction · 0.70
scheduleFunction · 0.70
tryCatchFunction · 0.70
getPersistedFunction · 0.70
isArray2Function · 0.70
setContentOrChangesFunction · 0.70
isUndefined2Function · 0.70
errorNewFunction · 0.70
saveAfterMutatedFunction · 0.70
setDefaultContentFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…