Navigation initiated in components to "/" results in error
westonwalker opened this issue · 2 comments
Hi there,
I have a form that on submit, saves some data and then redirects (without page reload) the user to the home page "/".
public void Submit()
{
if (!Validate())
{
return;
}
var newContact = new Contact();
newContact.Name = Name;
newContact.Email = Email;
Database.Contacts.Add(newContact);
Location(Url.Page("/"));
}
The location change results in an error. It looks like when passing "" or "/" to the Url.Page method, the resulting path is null. Network request below showing "path": null. This works fine when passing urls that aren't the home page.
Hi! The pageName
parameter expects a valid Razor Page name, so it will be either "/Index" or "/Home/Index" or similar depending on your folder structure.
It seems it would be good in Hydro to check the path that is passed to Location
, and if it's null or empty throw appropriate exception. Will fix.
Thanks for the quick reply. Really enjoyed using the library yesterday!