Include catch in wrappers
This commit is contained in:
@@ -66,10 +66,11 @@ const ReactUtils = {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.element = element;
|
||||
this.state = {hasError: false};
|
||||
}
|
||||
|
||||
componentDidCatch() {this.setState({hasError: true});}
|
||||
componentDidMount() {this.refs.element.appendChild(this.element);}
|
||||
render() {return DiscordModules.React.createElement("div", {className: "react-wrapper", ref: "element"});}
|
||||
render() {return this.state.hasError ? null : DiscordModules.React.createElement("div", {className: "react-wrapper", ref: "element"});}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -293,6 +293,11 @@ export default class Modals {
|
||||
super(props);
|
||||
this.elementRef = React.createRef();
|
||||
this.element = panel;
|
||||
this.state = {hasError: false};
|
||||
}
|
||||
|
||||
componentDidCatch() {
|
||||
this.setState({hasError: true});
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
@@ -300,6 +305,7 @@ export default class Modals {
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.state.hasError) return null;
|
||||
const props = {
|
||||
className: "bd-addon-settings-wrap",
|
||||
ref: this.elementRef
|
||||
|
||||
Reference in New Issue
Block a user