Closed egil closed 2 months ago
These are the current way htmxor maps blazors navigation manager options. Ill close this issue. If it turns out this is not ideal, we can revisit it:
var navOptions = navigationException.Options;
if (htmxContext.Request.IsHtmxRequest)
{
if (navOptions.ForceLoad)
{
htmxContext.Response.Redirect(navigationException.RequestedLocation);
if (navOptions.ReplaceHistoryEntry)
{
htmxContext.Response.ReplaceUrl(navigationException.RequestedLocation);
}
}
else
{
if (navOptions.ReplaceHistoryEntry)
{
htmxContext.Response.ReplaceUrl(navigationException.RequestedLocation);
}
else
{
htmxContext.Response.Redirect(navigationException.RequestedLocation);
}
}
}
else
{
httpContext.Response.Redirect(navigationException.Location);
}
How should we map between the
NavigationManager.NavigateTo
calls with and without NavigationOptions and HX- headers?My current thinking is:
If the
NavigateTo
call happens during a non-hx request, a standard 302 redirect status code is used with the absolute url.