Skip to content

Fix/hot reload shutdown - #8

Merged
davidwhitney merged 3 commits into
davidwhitney:mainfrom
DBeardionaire:fix/hot-reload-shutdown
Sep 21, 2026
Merged

davidwhitney merged 3 commits into
davidwhitney:mainfrom
DBeardionaire:fix/hot-reload-shutdown

Conversation

@DBeardionaire

Copy link
Copy Markdown
Contributor

Connected HMR WebSockets can keep requests alive during application shutdown, delaying the host from stopping. I 1st saw this when using aspire rebuild/restart and then with dotnet run and Ctrl + C.

Registers the hot reload service with IHostApplicationLifetime.ApplicationStopping so shutdown aborts connected sockets and unsubscribes from build notifications. Guarded client registration so connections arriving during shutdown are also aborted, and reuse the cleanup during disposal.

Adds a component regression test that connects an HMR client, triggers application stopping, and verifies the service clears its connected clients.

@DBeardionaire

Copy link
Copy Markdown
Contributor Author

I also see a test failing locally in LargeGraphTests that I didn't include in case it should be handled separately or is just failing on my machine

JsxCore/test/JsxCore.Tests/Unit/PackageManagement/Native/LargeGraphTests.cs

[Theory]
[InlineData("eslint")]
[InlineData("webpack")]
[InlineData("jest")]
public async Task Resolve_LargeGraph_ProducesATreeWhereEveryDependencyResolves(string package)
{
    var placed = await new PackageResolver(Registry()).ResolveAsync([new PackageRequest(package, "")]);

    placed.Count.ShouldBeGreaterThan(50);
    PackageResolver.Validate(placed).ShouldBeEmpty();
}

@davidwhitney

Copy link
Copy Markdown
Owner

Thanks for this, this looks good I'll get it bundled and released.

@davidwhitney
davidwhitney merged commit e97be56 into davidwhitney:main Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants