Repository navigation
fix: better handling of resync and restarts in content layer - #12984
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 8452a0d The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #12984 will not alter performanceComparing Summary
|
| export function createWatcherWrapper(watcher: FSWatcher): WrappedWatcher { | ||
| const listeners = new Map<WatchEventName, Set<WatchEventCallback>>(); | ||
|
|
||
| const handler: ProxyHandler<FSWatcher> = { |
Member
There was a problem hiding this comment.
Isn't a proxy overkill for this? Could it be an object?
return {
on: (event, callback) => {
if (!listeners.has(event)) {
listeners.set(event, new Set());
}
// Track the listener
listeners.get(event)!.add(callback);
return watcher.on(event, callback)
},
// off, etc
}Or is it because you want to support all other methods too?
Contributor
Author
There was a problem hiding this comment.
Yeah, it's a public API, so it would be a breaking change if I changed the type.
Closed
1 task
ematipico
approved these changes
Jan 16, 2025
Merged
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
This PR makes a number of changes to the way that file watchers work in dev with the content layer. There have been a few bugs related to the way that dev server restarts are handled, which were due to the way we were handling file watchers.
When the Astro config is edited, it restarts the dev container to ensure the site is using the latest config. This was causing several bugs:
This PR correctly passes in the watcher, but has to handle various implications of this:
Testing
Added new test cases
Docs