fix: don't swallow file changes when a lot of them come in #6075
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When frameworks perform a build during local dev, they sometimes touch a lot of files at the same time, and chokidar will notify about those. Since we were debouncing them, only one of those file updates came through to the bundling implementation - all others were swallowed. If that means the function file is swallowed, we don't rebuild functions/edge functions when we should.
I thought about removing the debouncing behaviour, but it's useful so we don't perform too many builds (wasting CPU). Instead, I opted for collecting all paths that are changed, and passing the full list down once the debouncer makes the call. This ensures that our build system has all changed files and can correctly determine when to build.