MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / read

Function read

graph-ui/src/impact/SelectionImpactWidget.tsx:48–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46 let attempts = 0;
47 const selection = { filePath: file, qualifiedName: qn, id };
48 const read = async (): Promise<void> => {
49 try {
50 setState('loading');
51 const reply = await load(project, selection, controller.signal, refresh > 0 && attempts === 0);
52 if (controller.signal.aborted) return;
53 attempts++;
54 if (reply.status === 'ready') { setReading({ key: selectionKey, data: reply }); setState('ready'); }
55 else if (reply.status === 'failed') { setError(reply.error); setState('failed'); }
56 else if (attempts < 80) {
57 setState(reply.status);
58 timer = setTimeout(() => { void read(); }, 500);
59 } else { setError('Analysis is taking longer than expected. Refresh to retry.'); setState('failed'); }
60 } catch (cause) {
61 if (!controller.signal.aborted) {
62 setError(cause instanceof Error ? cause.message : String(cause)); setState('failed');
63 }
64 }
65 };
66 void read();
67 return () => { controller.abort(); if (timer !== undefined) clearTimeout(timer); };
68 }, [project, file, qn, id, refresh, load, expectedGeneration, selectionKey]);

Callers 1

SelectionImpactWidgetFunction · 0.70

Calls 2

setReadingFunction · 0.85
loadFunction · 0.50

Tested by

no test coverage detected