Skip to content

fix(@angular/build): watchers outside the workspace via parcel didn't work - #34187

Merged
clydin merged 1 commit into
angular:mainfrom
sod:fix-watch
Sep 28, 2026
Merged

clydin merged 1 commit into
angular:mainfrom
sod:fix-watch

Conversation

@sod

@sod sod commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The dirKey entry in this.pendingSubscriptions caused the following if to never be true, as !this.isCoveredByExistingExternal(dirKey) is always true as long as dirKey is in there. But at this point it isn't pending anymore, as we just awaited it the LoC prior.

This bug caused to always run the else which did sub.unsubscribe() and killed the just spawned watcher. The effect was, that a directory outside the workspace wasn't watched anymore.

This worked prior to 22.2, but regressed with the switch to the parcel watcher.

See reproduction https://github.com/sod/issue-watcher

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the ParcelExternalManager class in watcher.ts to delete the dirKey from pendingSubscriptions once the subscription promise resolves. There are no review comments, and I have no feedback to provide on this change.

@alan-agius4

alan-agius4 commented Sep 28, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for the fix! Could you please fix the typos in the commit message body (with did ... with killed -> which did ... and killed, and iports -> imports)?

@alan-agius4 alan-agius4 added the target: patch This PR is targeted for the next patch release label Sep 28, 2026
… work

The `dirKey` entry in `this.pendingSubscriptions` caused the following `if` to never be true, as `this.isCoveredByExistingExternal(dirKey)` is always true as long as `dirKey` is in there. But at this point it isn't pending anymore, as we just `await`ed it the LoC prior.

This bug caused the `else` to always run, which did `sub.unsubscribe()`, which killed the just spawned watcher. The effect was that a directory outside the workspace wasn't watched anymore.

E.g. this structure:

```
apps/my-angular-app
libs/my-angular-sdk
node_modules/@my/sdk => symlink to libs/my-angular-sdk
```

When you ran `ng serve` in `apps/my-angular-app` (which has imports to `@my/sdk`) and made a change in `libs/my-angular-sdk`, then the watcher didn't rebuild (which it did before in 21.x).
@sod

sod commented Sep 28, 2026

Copy link
Copy Markdown
Contributor Author

Thanks. I fixed broken english in my commit message and force pushed it.

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Sep 28, 2026
@clydin
clydin merged commit 83eedfa into angular:main Sep 28, 2026
40 checks passed
@clydin

clydin commented Sep 28, 2026

Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

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

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants