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

Navigation BACK Button not working in Hybrid Mode #8

Open
wbalzer opened this issue Apr 10, 2022 · 1 comment
Open

Navigation BACK Button not working in Hybrid Mode #8

wbalzer opened this issue Apr 10, 2022 · 1 comment

Comments

@wbalzer
Copy link

wbalzer commented Apr 10, 2022

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.

@wbalzer wbalzer changed the title Navigation History Navigation BACK Button not working in Hybrid Mode Apr 10, 2022
@jdtcn
Copy link
Owner

jdtcn commented Apr 12, 2022

Hello, thank you for your interest in the project and for the information about the findings. I tried to reproduce the problem with navigation but could not, the back button works for me (checked Chrome, Firefox). Have you used the latest version of the code? I just fixed a problem with navigation a month ago.

Gif ![Animation](https://user-images.githubusercontent.com/47177226/163042441-cde5d85f-f18e-427c-ac4d-8348466f7a32.gif)

I haven't tried HeadOutlet yet, but I'll take a look, thanks.

Of course post your project on github, it will be interesting to see the implementation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants