Skip to content

Commit

Permalink
fix: Navigate once when starting app
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklimakc committed Dec 9, 2024
1 parent 44e66c1 commit 7310dd5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Uno.Extensions.Navigation.UI/FrameworkElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public static Task HostAsync(
var nav = elementRegion.Navigator();
if (nav is not null)
{
var initialNavigation = () => nav.NavigateRouteAsync(root, initialRoute ?? string.Empty);

var start = () => Task.CompletedTask;

var hostConfigOptions = sp.GetService<IOptions<HostConfiguration>>();
if (hostConfigOptions?.Value is { } hostConfig &&
hostConfig.LaunchRoute() is { } launchRoute &&
Expand All @@ -55,12 +54,18 @@ public static Task HostAsync(
{
start = () => nav.NavigateViewModelAsync(root, initialViewModel);
}
else
{
start = () => nav.NavigateRouteAsync(root, initialRoute ?? string.Empty);
}

var fullstart = async () =>
{
await initialNavigation();
await start();
};

var startupTask = elementRegion.Services!.Startup(fullstart);

return startupTask;
}
return Task.CompletedTask;
Expand Down

0 comments on commit 7310dd5

Please sign in to comment.