You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current spec says that this always does a replace navigation, similar to location.href = location.href. This is a bit weird because it means that the replace parameter is ignored, e.g.
// All three of these are equivalent: they all do a replace.navigation.navigate(navigation.currentEntry.url);navigation.navigate(navigation.currentEntry.url,{replace: true});navigation.navigate(navigation.currentEntry.url,{replace: false});
We discussed a few options for what to do:
Do a same-document navigation, either push or replace according to the replace option.
But, this is not great because in general we want navigate() to be about new-document navigations; to make them same-document, you intercept with the navigate event.
Do a new-document replace navigation, ignoring the replace option
Precedent: location.href = location.href, or location.assign(location.href).
This is the spec's current behavior.
Do a new-document navigation, either push or replace according to the replace option.
A new-document push navigation to the same URL as the current one is only possible today by using redirects, and only in some browsers.
(3), but have the default be a somewhat-magic "replace for same-URL, push for different-URL". I.e.
navigation.navigate(navigation.currentEntry.url);// does a replacenavigation.navigate(navigation.currentEntry.url,{replace: true});// does a replacenavigation.navigate(navigation.currentEntry.url,{replace: false});// does a pushnavigation.navigate(someOtherURL);// does a pushnavigation.navigate(someOtherURL,{replace: true});// does a replacenavigation.navigate(someOtherURL,{replace: false});// does a push
Return a rejected promise whenever you pass replace: false and try to navigate to the current URL.
Return a rejected promise whenever you pass anything besides replace: true and try to navigate to the current URL. I.e. you need to be super-explicit.
We were leaning toward (4), although the lack of good precedent is a bit tricky.
@jakearchibald, @annevk, @smaug---- and I discussed the behavior of
navigation.navigate(appHistory.current.url)today.The current spec says that this always does a replace navigation, similar to
location.href = location.href. This is a bit weird because it means that thereplaceparameter is ignored, e.g.We discussed a few options for what to do:
Do a same-document navigation, either push or replace according to the
replaceoption.pushState(null, "")/replaceState(null, "")navigate()to be about new-document navigations; to make them same-document, you intercept with thenavigateevent.Do a new-document replace navigation, ignoring the
replaceoptionlocation.href = location.href, orlocation.assign(location.href).Do a new-document navigation, either push or replace according to the
replaceoption.(3), but have the default be a somewhat-magic "replace for same-URL, push for different-URL". I.e.
Return a rejected promise whenever you pass
replace: falseand try to navigate to the current URL.Return a rejected promise whenever you pass anything besides
replace: trueand try to navigate to the current URL. I.e. you need to be super-explicit.We were leaning toward (4), although the lack of good precedent is a bit tricky.