MCPcopy Index your code
hub / github.com/codeaashu/claude-code / #rewatch

Method #rewatch

src/hooks/useTasksV2.ts:90–105  ·  view source on GitHub ↗

* Point the file watcher at the current tasks directory. Called on start * and whenever #fetch detects the task list ID has changed (e.g. when * TeamCreateTool sets leaderTeamName mid-session).

(dir: string)

Source from the content-addressed store, hash-verified

88 * TeamCreateTool sets leaderTeamName mid-session).
89 */
90 #rewatch(dir: string): void {
91 // Retry even on same dir if the previous watch attempt failed (dir
92 // didn't exist yet). Once the watcher is established, same-dir is a no-op.
93 if (dir === this.#watchedDir && this.#watcher !== null) return
94 this.#watcher?.close()
95 this.#watcher = null
96 this.#watchedDir = dir
97 try {
98 this.#watcher = watch(dir, this.#debouncedFetch)
99 this.#watcher.unref()
100 } catch {
101 // Directory may not exist yet (ensureTasksDir is called by writers).
102 // Not critical — onTasksUpdated covers in-process updates and the
103 // poll timer covers cross-process updates.
104 }
105 }
106
107 #debouncedFetch = (): void => {
108 if (this.#debounceTimer) clearTimeout(this.#debounceTimer)

Callers 1

TasksV2StoreClass · 0.95

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected