-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor FileWatcher into a Class #4916
base: main
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
cca2ed9
to
4ccf516
Compare
private readonly close = () => { | ||
outputDebug(`Closing file watcher`, this.options.stdout) | ||
this.watcher | ||
?.close() | ||
.then(() => outputDebug(`File watching closed`, this.options.stdout)) | ||
.catch((error: Error) => outputDebug(`File watching failed to close: ${error.message}`, this.options.stderr)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The close
method should remove the event listener that was added to options.signal
in the start
method. Not removing it could cause memory leaks if the FileWatcher
instance is reused, as the old listener would remain attached to the signal.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
4ccf516
to
7306041
Compare
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1958 tests passing in 888 suites. Report generated by 🧪jest coverage report action from ff1bc64 |
packages/app/src/cli/services/dev/app-events/app-event-watcher.test.ts
Outdated
Show resolved
Hide resolved
7306041
to
d975467
Compare
77a4f78
to
1b4002b
Compare
We detected some changes at packages/*/src and there are no updates in the .changeset. |
0899271
to
4536258
Compare
4536258
to
ff1bc64
Compare
WHY are these changes introduced?
Refactors the file watcher implementation into a class-based structure to improve maintainability and testability of the file watching system used during app development.
WHAT is this pull request doing?
NO NEW FEATURES, mainly a refactor:
FileWatcher
classmicromatch
, it's not used anymore.How to test your changes?
dev
command on an app with multiple extensionsMeasuring impact
Checklist