MCPcopy Index your code
hub / github.com/coder/mux / fetchState

Function fetchState

src/browser/hooks/usePostCompactionState.ts:56–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55 let cancelled = false;
56 const fetchState = async () => {
57 try {
58 const result = await api.workspace.getPostCompactionState({ workspaceId });
59 if (cancelled) return;
60
61 // Update state
62 setState({
63 planPath: result.planPath,
64 trackedFilePaths: result.trackedFilePaths,
65 excludedItems: new Set(result.excludedItems),
66 });
67
68 // Cache for next time
69 updatePersistedState<CachedPostCompactionData>(getPostCompactionStateKey(workspaceId), {
70 planPath: result.planPath,
71 trackedFilePaths: result.trackedFilePaths,
72 excludedItems: result.excludedItems,
73 });
74 } catch (error) {
75 // Silently fail - use cached or empty state
76 console.warn("[usePostCompactionState] Failed to fetch:", error);
77 }
78 };
79
80 void fetchState();
81 return () => {

Callers 1

usePostCompactionStateFunction · 0.85

Calls 3

updatePersistedStateFunction · 0.90

Tested by

no test coverage detected