Skip to content

Always download blazor-hotreload.js from app root #36862

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

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

pranavkm
Copy link
Contributor

@pranavkm pranavkm commented Sep 22, 2021

Port #35737 to release/6.0

Description

Hot reload for WebAssembly attempts to download a JS script as part of booting up the app which is served from the root of the app (e.g. /_framework/blazor-hotreload.js). Blazor constructs a URL for the script and downloads it. Currently this URL is relative to where Blazor is hosted. Blazor also allows a way to configure it to be served from a subdirectory of the app root. In this case, the URL for the script is incorrectly constructed (e.g. /mycustomsubdir/_framework/blazor-hotreload.js) which causes the app to fail loading.

Regression

No.

Testing

The change was manually tested.

Risk

There's a very uncommon scenario where the user does additional work to host the entire app of a virtual subdirectory which this change regresses. However, other scripts scripts that VS injects in to the app (browser-link for css updates) are already broken in this case so we're not making things significantly worse.

Issues

Fixes #35555
Fixes #35967

The middleware that we inject always listens to the root of the app. While this might not play very nicely if the app
is running off a virtual path, listening to the root is what we do with the aspnet-browser-refresh.js script and we've had no issue
reports with it thus far.

Fixes #35555
@pranavkm pranavkm requested a review from a team as a code owner September 22, 2021 23:03
@ghost ghost added the area-blazor Includes: Blazor, Razor Components label Sep 22, 2021
@pranavkm
Copy link
Contributor Author

@Pilchie for 6.0 consideration. I missed porting this change over to rc2 when I initially made this. Did a quick scan to verify other changes that I made for rc2 are actually there.

@Pilchie
Copy link
Member

Pilchie commented Sep 22, 2021

Approved for .NET Core 6.0.

@TanayParikh
Copy link
Contributor

@dotnet/aspnet-build requesting merge.

@wtgodbe wtgodbe merged commit 7069706 into release/6.0 Sep 23, 2021
@wtgodbe wtgodbe deleted the prkrishn/port-35737 branch September 23, 2021 16:12
@ghost ghost added this to the 6.0.0 milestone Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants