-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Replace jquery.confirmExit #8264
Conversation
window.removeEventListener('beforeunload', this.onBeforeUnload); | ||
} | ||
|
||
// eslint-disable-next-line consistent-return |
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.
Isn't a code-smell to have a non consistent return ?
What should be fore if this.snapshotValue === this.snapshot
?
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.
return ''
or return null
or return false
it may trigger dialog, of course if use retrun;
will be work but eslint all the same throw error. We are already disable rule in https://github.com/sonata-project/SonataAdminBundle/blob/4.x/assets/js/jquery.confirmExit.js#L20
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.
Im mean it's will be not work, eslint all the same throw consistent-return
error
beforeUnload(event) {
const message = Translation.trans('CONFIRM_EXIT');
if (this.snapshotValue === this.snapshot) {
return;
}
event.returnValue = message;
return message;
}
Consider adding tests to this new controllers. It should be way easy to test this features with stimulus |
Subject
Parts #7158 #7156
Changelog
### Changed Replace jquery.confirmExit to vanilla js