});
}
+ componentDidUpdate() {
+ if (this.state.commentForm.content) {
+ window.onbeforeunload = () => true;
+ } else {
+ window.onbeforeunload = undefined;
+ }
+ }
+
componentWillUnmount() {
this.subscription.unsubscribe();
+ window.onbeforeunload = null;
}
render() {
});
}
+ componentDidUpdate() {
+ if (
+ !this.state.loading &&
+ (this.state.communityForm.name ||
+ this.state.communityForm.title ||
+ this.state.communityForm.description)
+ ) {
+ window.onbeforeunload = () => true;
+ } else {
+ window.onbeforeunload = undefined;
+ }
+ }
+
componentWillUnmount() {
this.subscription.unsubscribe();
+ window.onbeforeunload = null;
}
render() {
setupTippy();
}
+ componentDidUpdate() {
+ if (
+ !this.state.loading &&
+ (this.state.postForm.name ||
+ this.state.postForm.url ||
+ this.state.postForm.body)
+ ) {
+ window.onbeforeunload = () => true;
+ } else {
+ window.onbeforeunload = undefined;
+ }
+ }
+
componentWillUnmount() {
this.subscription.unsubscribe();
+ window.onbeforeunload = null;
}
render() {
setupTippy();
}
+ componentDidUpdate() {
+ if (!this.state.loading && this.state.privateMessageForm.content) {
+ window.onbeforeunload = () => true;
+ } else {
+ window.onbeforeunload = undefined;
+ }
+ }
+
componentWillUnmount() {
this.subscription.unsubscribe();
+ window.onbeforeunload = null;
}
render() {
this.setState(this.state);
}
+ componentDidUpdate() {
+ if (
+ !this.state.loading &&
+ !this.props.site &&
+ (this.state.siteForm.name || this.state.siteForm.description)
+ ) {
+ window.onbeforeunload = () => true;
+ } else {
+ window.onbeforeunload = undefined;
+ }
+ }
+
+ componentWillUnmount() {
+ window.onbeforeunload = null;
+ }
+
render() {
return (
<>