MCPcopy
hub / github.com/coder/mux / subscribeToFileModifications

Method subscribeToFileModifications

src/browser/stores/GitStatusStore.ts:1096–1113  ·  view source on GitHub ↗

* 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
  )

Source from the content-addressed store, hash-verified

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// ============================================================================

Callers 1

AppLoaderInnerFunction · 0.80

Calls 2

scheduleMethod · 0.80

Tested by

no test coverage detected