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

Unwanted reload of Blazor wasm #18986

Closed
istvanloth opened this issue Feb 12, 2020 · 3 comments
Closed

Unwanted reload of Blazor wasm #18986

istvanloth opened this issue Feb 12, 2020 · 3 comments
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved

Comments

@istvanloth
Copy link

(First I'd like to say sorry, my english isn't very good).

My Environment:

  • Blazor 3.2.0-preview1.20073.1 (this problem was exists in the previous versions also)
  • VS 2019 Community (fresh)
  • Blazor WebAssemblyApp(s) with "ASP.NET Core Hosted option)

Wasm reloads many time in my complex solution. I can't identify the cause in every case but I can reproduce it in a special one: load a page from another assembly than the Client.

Steps to reproduce:

  • Create a new Blazor Web Assembly with hosting (In my example called: TestBlazorApp)
  • Add a Razor Class library (TestPortal) to store portal pages (simple solution, the real is more complex)
  • Add new Razor Component (PortalTestPage1) to portal project and modify it to page with route: @page "/portal/page1"
  • Add reference in TestBlazorApp.Client to Portal
  • Modify App.razor to find route in TestPortal assembly:
  • Start the TestBlazorApp.Server as usual
  • After it's loaded than modify the address in the browser: http://localhost:5001/portal/page1
  • You can see "Loading...." on blank window than the page is appears correctly.
    (btw wasm reloads in case if you try to navigate to non exists page also)

Do you have any idea how can I avoid this reload?
TestBlazorApp.zip

@Pilchie Pilchie added the area-blazor Includes: Blazor, Razor Components label Feb 12, 2020
@javiercn javiercn added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Feb 13, 2020
@javiercn
Copy link
Member

@istvanloth thanks for contacting us.

I believe that's by design. Changing the URL in the browser will always cause a full page refresh, that's the browser behavior. There's nothing Blazor can do to prevent that.

@javiercn javiercn added ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question labels Feb 13, 2020
@ghost ghost added the Status: Resolved label Feb 13, 2020
@istvanloth
Copy link
Author

Ouch. Thanks to answered it!
(To test the new functionality i just wrote the address to the address bar. With link or navigatto it's working without reload)

@javiercn
Copy link
Member

I'm closing the issue as there's nothing else for us to do here.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly ✔️ Resolution: Answered Resolved because the question asked by the original author has been answered. question Status: Resolved
Projects
None yet
Development

No branches or pull requests

3 participants