()
| 427 | } |
| 428 | |
| 429 | private async onHeadChanged(): Promise<void> { |
| 430 | // HEAD changed — could be a branch switch or detach. |
| 431 | // Defer file I/O (readGitHead, watchFile setup) until scroll settles so |
| 432 | // watchFile callbacks that land mid-scroll don't compete for the event |
| 433 | // loop. invalidate() is cheap (just marks dirty) so do it first — the |
| 434 | // cache correctly serves stale-marked values until the watcher updates. |
| 435 | this.invalidate() |
| 436 | await waitForScrollIdle() |
| 437 | await this.watchCurrentBranchRef() |
| 438 | } |
| 439 | |
| 440 | private invalidate(): void { |
| 441 | for (const entry of this.cache.values()) { |
no test coverage detected