()
| 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 () => { |
no test coverage detected