-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Closed
Copy link
Labels
area: routerfreq3: highopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).An issue that is suitable for a community contributor (based on its complexity/scope).router: navigation pipeevents/scheduleNavigation/transitions observableevents/scheduleNavigation/transitions observablestate: confirmedtype: bug/fix
Milestone
Description
🐞 bug report
Affected Package
The issue is caused by package @angular/router....Is this a regression?
NoDescription
I think there is a small bug - the `history.state` object is getting lost when navigate using back/forward buttons.The fix should be pretty simple- set the restored state into the NavigationExtras parameter in the call of scheduleNavigation in Router.setUpLocationChangeListener() method :
// Navigations coming from Angular router have a navigationId state property. When this
// exists, restore the state.
const state = change.state && change.state.navigationId ? change.state : null;
setTimeout(
() => { this.scheduleNavigation(rawUrlTree, source, state, {replaceUrl: true, state }); }, 0);🔬 Minimal Reproduction
https://stackblitz.com/edit/angular-bupuzn created by @fjauer - just use back/forward after pressing Test button
🔥 Exception or Error
🌍 Your Environment
Angular Version:
Angular CLI: 7.2.1
Node: 10.15.0
OS: win32 x64
Angular: 7.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.12.1
@angular-devkit/build-angular 0.12.1
@angular-devkit/build-optimizer 0.12.1
@angular-devkit/build-webpack 0.12.1
@angular-devkit/core 7.2.1
@angular-devkit/schematics 7.2.1
@angular/cdk 7.2.1
@angular/cli 7.2.1
@angular/flex-layout 7.0.0-beta.23
@angular/material 7.2.1
@ngtools/webpack 7.2.1
@schematics/angular 7.2.1
@schematics/update 0.12.1
rxjs 6.0.0
typescript 3.2.2
webpack 4.23.1
Anything else relevant?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: routerfreq3: highopen for contributionsAn issue that is suitable for a community contributor (based on its complexity/scope).An issue that is suitable for a community contributor (based on its complexity/scope).router: navigation pipeevents/scheduleNavigation/transitions observableevents/scheduleNavigation/transitions observablestate: confirmedtype: bug/fix