Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor web assembly does not render a new page after navigating to it

$
0
0

I have a Blazor wasm project with pre-rendering disabled.

When I open the site on a computer, everything works fine. On mobile devices, I get a blank page when I navigate.

I don't know where the problem is, so I'll show the code where it's probably problematic:

<Router AppAssembly="typeof(Program).Assembly"><Found Context="routeData">        @if (navigationManager.Uri.Contains("/market"))        {<RouteView RouteData="@routeData" DefaultLayout="typeof(Layouts.MarketLayout)" />        }        else if (navigationManager.Uri.Contains("/user"))        {<RouteView RouteData="@routeData" DefaultLayout="typeof(Layouts.UserLayout)" />        }        else if (navigationManager.Uri.Contains("/admin"))        {<RouteView RouteData="@routeData" DefaultLayout="typeof(Layouts.AdminLayout)" />        }        else        {<RouteView RouteData="@routeData" DefaultLayout="typeof(Layouts.AppMainLayout)" />        }<FocusOnNavigate RouteData="routeData" Selector="h1" /></Found><NotFound></NotFound></Router>

Three asynchronous tasks are started in the main layout:

protected override async Task OnInitializedAsync(){    await searchEngine.Initialize();    await purchasesManager.SyncPurchases();    await purchasesManager.SyncPurchases();}

If you clear the cache, everything works on the mobile device at first startup. Then after rebooting, everything crashes again.

I tried explicitly calling StateHasChanged after updating navigationManager.LocationChanged. No results


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>