router: warn user if there are unsaved edits when navigating away #5223
Conversation
…m the current route
|
Updated the local test screencast, clicking on back button seems to only work when the navigation is |
| on(actions.discardDirtyUpdates, (state) => { | ||
| return {...state}; | ||
| }), |
There was a problem hiding this comment.
Please undo this change; this is basically noop and we do not need to make changes to the app_routing state based on this action at all.
| expect(actualActions).toEqual([actions.discardDirtyUpdates()]); | ||
|
|
||
| tick(); | ||
| expect(actualActions).toEqual([ | ||
| actions.navigating({ |
There was a problem hiding this comment.
I am surprised that the test is passing here. Shouldn't the actualActions be an array with two elements where the first element in the actions.dsicardDirtyUpdates()? Similarly, I expected the L352 to have three elements. What am I missing?
There was a problem hiding this comment.
I used fakeAsync incorrectly as below and it didn't capture the errors :(
it ('wrong test', () => {
fakeAsync(() => {})
});
Fixed now.
…nsorflow#5223) * warn user if there are unsaved edits when navigating away from the current route * fire discardDirtyUpdates action when user wants to discard unsaved changes
…nsorflow#5223) * warn user if there are unsaved edits when navigating away from the current route * fire discardDirtyUpdates action when user wants to discard unsaved changes
Warn user with
window.confirmif there are unsaved edits when navigating away from the current route:dispatchNavigating$.