Skip to content

Ignore file watcher change events that omit a changes payload - #1863

Open
Hashim1999164 wants to merge 1 commit into
react:mainfrom
Hashim1999164:fix/ignore-incomplete-change-events
Open

Ignore file watcher change events that omit a changes payload#1863
Hashim1999164 wants to merge 1 commit into
react:mainfrom
Hashim1999164:fix/ignore-incomplete-change-events

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 18, 2026

Copy link
Copy Markdown

Fixes #1767

Some third party watchers emit a bare change event with no ChangeEvent payload. DeltaCalculator and DependencyGraph then read changes.addedFiles and throw.

These handlers now return early when the payload is missing, so a bad event does not crash the bundler.

DeltaCalculator tests cover a change emit with no argument and with an empty object.

Changelog: [Fix] Ignore file watcher change events that omit a changes payload

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 18, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 18, 2026
@robhogan

Copy link
Copy Markdown
Collaborator

We shouldn't be dropping events. This sounds more like a version mismatch issue than a "third party watchers" issue. What's your setup?

@Hashim1999164

Copy link
Copy Markdown
Author

The crash in #1767 came from nativewind calling FileMap.emit('change') with no ChangeEvent (react-native-css-interop onChange). I do not have a Metro version mismatch in that stack. DependencyGraph and DeltaCalculator both assume the watcher always sends addedFiles / modifiedFiles / deletedFiles.

If dropping a bare change event is the wrong call, I can close this and leave it to nativewind to emit a real payload. Happy to reshape the PR if you would rather Metro treat a missing payload as an empty change set instead of returning early.

@robhogan

Copy link
Copy Markdown
Collaborator

Interesting - I didn't realise NativeWind had that level of integration. It looks like this was fixed upstream in nativewind/nativewind#1809 though.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: changes is undefined

2 participants