Open laingsimon opened 9 months ago
This could be vitejs or the dotnet core spa app, difficult to tell. It doesn't happen all the time, so suspect it is related to a slower than normal launch after a fresh build or branch switch
A change to this line would allow the window to open in the background/minimised
There is some unnecessary duplication in the SPA proxy launch manager:
IsSpaProxyRunning
can call directly onto the ProbeSpaDevelopmentServerUrl
(after creating a HttpClient
). The methods are identical otherwise.
Suspected cause:
SpaProxyStartupFilter
calls StartInBackground
(via StartIfNotRunning
)
npm start
)SpaProxyStartupFilter.Configure
is called again (assumed)
IsSpaProxyRunning
returns false (the proxy back-end doesn't respond with a HTTP 200-OK to the request)SpaProxyStartupFilter
calls StartInBackground
again - causing another instance of the back-end to be createdNote 1:
At this point the first process is orphaned, as the reference to it _spaProcess
is rewritten to the details of the second process
Suggested changes:
_spaProcess
is set to an instance, either:
SubsequentStartMethod
: ReLaunch (default, start another process) | Restart (kill and start another process) | WaitForFirst (trust the first process will get there eventually)
WindowStyle
: Normal (allow the os to position the window) | Minimized (minimize the process if the os allows it)
See changes here: https://github.com/dotnet/aspnetcore/pull/55375
Suggestion rejected by aspnet core developers. Remaining options are to:
Not sure if this is caused by the SPA app within dotnet or npm start. It is also possible, with a slow start, that the browser - Chrome - refreshes the page causing the backend to relaunch the server.
Either way the npm or spa dotnet app should prevent a double launch of the dev server
If possible, it would be useful for the spa app to launch
npm start
in a background windowhttps://github.com/laingsimon/courage_scores/blob/0713d27de5182c39298c12c37d678e4b4f379cbd/CourageScores/CourageScores.csproj#L11-L12
Nuget Package: Microsoft.AspNetCore.SpaProxy