Skip to content

fix(app): normalize watcher paths#24341

Open
pascalandr wants to merge 1 commit intoanomalyco:devfrom
Pagecran:fix/17780-watcher-path-normalization
Open

fix(app): normalize watcher paths#24341
pascalandr wants to merge 1 commit intoanomalyco:devfrom
Pagecran:fix/17780-watcher-path-normalization

Conversation

@pascalandr
Copy link
Copy Markdown

Issue for this PR

Closes #17780

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Watcher events on Windows can arrive with backslash-separated paths while open tabs and cached file tree entries are keyed with forward slashes. This normalizes watcher-side paths before matching open files or loaded file tree nodes. It also refreshes the nearest loaded ancestor for add/unlink events so changes under unloaded child directories still update the visible tree.

This intentionally keeps the fix scoped to the watcher invalidation path rather than changing general path normalization behavior.

How did you verify your code works?

  • bun test --preload ./happydom.ts ./src/context/file/watcher.test.ts from packages/app
  • bun test --preload ./happydom.ts ./src/context/file/path.test.ts ./src/context/file/watcher.test.ts from packages/app
  • bun typecheck from packages/app
  • pre-push bun turbo typecheck

Screenshots / recordings

N/A, non-UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

The search found one potentially related PR:

fix(watcher): filter ignored paths before publishing events, handle worktree git dirs - This PR also addresses watcher path handling, though it focuses on filtering ignored paths and handling git worktree directories rather than normalizing Windows path separators. It could be related depending on whether there's overlap in the watcher path processing logic.

However, this appears to be a different issue (PR #21453 is about filtering ignored paths, while PR #24341 is about normalizing path separators on Windows).

No other duplicate PRs found addressing the same issue #17780 or the same path normalization problem.

@pascalandr
Copy link
Copy Markdown
Author

pascalandr commented Apr 25, 2026

#21453 is related to watcher processing, but it addresses a different layer:

So the two changes should be complementary rather than duplicates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: file watcher paths stop matching open files on Windows

1 participant