Skip to content
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

Fix typegen watcher leak on dev restart #12331

Merged
merged 1 commit into from
Nov 21, 2024

Conversation

markdalgleish
Copy link
Member

@markdalgleish markdalgleish commented Nov 21, 2024

If the dev server is restarted (e.g. when Vite config changes) the old file watcher is still hanging around, with the following showing up in the terminal: MaxListenersExceededWarning: Possible EventEmitter memory leak detected.

I've confirmed that when restarting the dev server, Vite calls the buildEnd hook, so to fix this we need to ensure the typegen watcher is cleaned up at the same time.

Note that this is a minimal fix that aims to maintain the current architecture as much as possible, but I think it'd be worth following up with making the typegen code accept a ConfigLoader so that it can be shared with the Vite plugin rather than having two instances of it.

Copy link

changeset-bot bot commented Nov 21, 2024

🦋 Changeset detected

Latest commit: c0a4a6e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 10 packages
Name Type
@react-router/dev Patch
@react-router/fs-routes Patch
@react-router/remix-routes-option-adapter Patch
react-router Patch
react-router-dom Patch
@react-router/architect Patch
@react-router/cloudflare Patch
@react-router/express Patch
@react-router/node Patch
@react-router/serve Patch

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

@pcattori pcattori merged commit d0ac7ba into dev Nov 21, 2024
8 checks passed
@pcattori pcattori deleted the markdalgleish/fix-typegen-watcher-leak branch November 21, 2024 13:43
Copy link
Contributor

🤖 Hello there,

We just published version 7.0.1-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 7.0.1 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants