Skip to content

Navigation BACK Button not working in Hybrid Mode #8

@wbalzer

Description

@wbalzer

I love the idea here having the HybridOnNavigation option. I found an issue that when I am navigating from one page to another in the Hybrid mode, if I hit the BACK button which is very typical of users, the page didn't redraw. In Server mode or WebAssembly mode, the back buttons worked as expected.

With .Net 6, I did have issues with the HeadOutlet for HybridManual, or HybridOnReady. For WebAssembly or HybridOnNavigation, I created a workaround. As you can see, I had to comment out the HybridManual.

HybridTypeEnum? hybridType = null;
try
{
    hybridType = await httpClient.GetFromJsonAsync<HybridTypeEnum>("/api/hybridtype");
}
catch { }

hybridType ??= HybridTypeEnum.WebAssembly;

switch (hybridType)
{
    case HybridTypeEnum.WebAssembly:
    case HybridTypeEnum.WebAssemblyPreRendered:
        builder.RootComponents.Add<App>("#app");
        builder.RootComponents.Add<HeadOutlet>("head::after");
        break;
    case HybridTypeEnum.HybridOnNavigation:
        builder.RootComponents.Add<HeadOutlet>("head::after");
        break;
    case HybridTypeEnum.HybridManual:
        //builder.RootComponents.Add<HeadOutlet>("head::after");
        break;
    default:

        break;
}

FYI... I recreated the IdentityServer pages as razor components, working with Server, WebAssembly, WebAssemblyPreRendered, and HybridOnNavigation, and it works with Login Providers such as Facebook, Twitter, and Google. It works very well with very little configuration. The only time you leave your environment is when you authenticate with a remote provider. I haven't quite figured out the backend workings of Microsoft.Identity.Web, so I don't think it is quite ready to release as a NuGet, but I might put it on GitHub.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions