Skip to content

Commit

Permalink
Update queryParamsTransition to not change QueryParams if transition …
Browse files Browse the repository at this point in the history
…has been aborted
  • Loading branch information
richgt committed Jul 17, 2020
1 parent d8231d3 commit 8da70ea
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default abstract class Router<T extends Route> {
@param {Function} callback
*/
map(callback: MatchCallback) {
this.recognizer.map(callback, function(recognizer, routes) {
this.recognizer.map(callback, function (recognizer, routes) {
for (let i = routes.length - 1, proceed = true; i >= 0 && proceed; --i) {
let route = routes[i];
let handler = route.handler as string;
Expand Down Expand Up @@ -137,10 +137,12 @@ export default abstract class Router<T extends Route> {

newTransition.promise = newTransition.promise!.then(
(result: TransitionState<T> | Route | Error | undefined) => {
this._updateURL(newTransition, oldState);
this.didTransition(this.currentRouteInfos!);
this.toInfos(newTransition, newState.routeInfos, true);
this.routeDidChange(newTransition);
if (!newTransition.isAborted) {
this._updateURL(newTransition, oldState);
this.didTransition(this.currentRouteInfos!);
this.toInfos(newTransition, newState.routeInfos, true);
this.routeDidChange(newTransition);
}
return result;
},
null,
Expand Down Expand Up @@ -821,7 +823,7 @@ export default abstract class Router<T extends Route> {
*/
reset() {
if (this.state) {
forEach<InternalRouteInfo<T>>(this.state.routeInfos.slice().reverse(), function(routeInfo) {
forEach<InternalRouteInfo<T>>(this.state.routeInfos.slice().reverse(), function (routeInfo) {
let route = routeInfo.route;
if (route !== undefined) {
if (route.exit !== undefined) {
Expand Down

0 comments on commit 8da70ea

Please sign in to comment.