chore(navigate-away-prompt): merging two if conditions

This commit is contained in:
Sarah Vaupel 2021-08-24 10:40:51 +02:00
parent 49ac17f8e9
commit a5e666d155

View File

@ -107,13 +107,8 @@ export class NavigateAwayPrompt {
// allow the event to happen if the form was not touched by the
// user (i.e. if the current FormData is equal to the initial FormData)
// or the unload event was initiated by a form submit
if (!formDataHasChanged)
if (!formDataHasChanged || this.unloadDueToSubmit)
return;
if(this._unloadDueToSubmit) {
return;
}
// cancel the unload event. This is the standard to force the prompt to appear.
event.preventDefault();