ErrorBoundary: Do not use any Discord components to be more robust

This commit is contained in:
Vendicated 2023-02-25 19:10:01 +01:00
parent ccca41a168
commit 128ee41252
No known key found for this signature in database
GPG key ID: A1DC0CFB5615D905
4 changed files with 20 additions and 23 deletions

View file

@ -17,8 +17,9 @@
*/
import Logger from "@utils/Logger";
import { Margins } from "@utils/margins";
import { LazyComponent } from "@utils/misc";
import { Margins, React } from "@webpack/common";
import { React } from "@webpack/common";
import { ErrorCard } from "./ErrorCard";
@ -84,15 +85,13 @@ const ErrorBoundary = LazyComponent(() => {
const msg = this.props.message || "An error occurred while rendering this Component. More info can be found below and in your console.";
return (
<ErrorCard style={{
overflow: "hidden",
}}>
<ErrorCard style={{ overflow: "hidden" }}>
<h1>Oh no!</h1>
<p>{msg}</p>
<code>
{this.state.message}
{!!this.state.stack && (
<pre className={Margins.marginTop8}>
<pre className={Margins.top8}>
{this.state.stack}
</pre>
)}