* Subscribe to file-modifying tool completions from WorkspaceStore. * Triggers debounced git status refresh when files change. * Idempotent: only subscribes once, subsequent calls are no-ops.
(
subscribeAny: (listener: (workspaceId: string) => void) => () => void
)
| 1094 | * Idempotent: only subscribes once, subsequent calls are no-ops. |
| 1095 | */ |
| 1096 | subscribeToFileModifications( |
| 1097 | subscribeAny: (listener: (workspaceId: string) => void) => () => void |
| 1098 | ): void { |
| 1099 | // Only subscribe once - subsequent calls are no-ops |
| 1100 | if (this.fileModifyUnsubscribe) { |
| 1101 | return; |
| 1102 | } |
| 1103 | |
| 1104 | this.fileModifyUnsubscribe = subscribeAny((workspaceId) => { |
| 1105 | // Only schedule if workspace has subscribers (same optimization as before) |
| 1106 | if (!this.hasWorkspaceSubscribers(workspaceId)) { |
| 1107 | return; |
| 1108 | } |
| 1109 | |
| 1110 | // RefreshController handles debouncing, focus gating, and in-flight guards |
| 1111 | this.refreshController.schedule(); |
| 1112 | }); |
| 1113 | } |
| 1114 | } |
| 1115 | |
| 1116 | // ============================================================================ |
no test coverage detected