-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks!
expect(actualActions).toEqual([actions.discardDirtyUpdates()]); | ||
|
||
tick(); | ||
expect(actualActions).toEqual([ | ||
actions.navigating({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.confirm
if there are unsaved edits when navigating away from the current route:dispatchNavigating$
.