mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Separated specification and implementation in TopErrorBoundary (#1031)
* Encapsulate SceneHistory. A little. * Clean up TopErrorBoundary
This commit is contained in:
parent
f6b36519f1
commit
1e8cd2bd1c
1 changed files with 62 additions and 62 deletions
|
@ -20,6 +20,10 @@ export class TopErrorBoundary extends React.Component<
|
||||||
localStorage: "",
|
localStorage: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return this.state.hasError ? this.errorSplash() : this.props.children;
|
||||||
|
}
|
||||||
|
|
||||||
componentDidCatch(error: Error) {
|
componentDidCatch(error: Error) {
|
||||||
resetCursor();
|
resetCursor();
|
||||||
const _localStorage: any = {};
|
const _localStorage: any = {};
|
||||||
|
@ -88,8 +92,7 @@ export class TopErrorBoundary extends React.Component<
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
private errorSplash() {
|
||||||
if (this.state.hasError) {
|
|
||||||
return (
|
return (
|
||||||
<div className="ErrorSplash">
|
<div className="ErrorSplash">
|
||||||
<div className="ErrorSplash-messageContainer">
|
<div className="ErrorSplash-messageContainer">
|
||||||
|
@ -155,7 +158,4 @@ export class TopErrorBoundary extends React.Component<
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.props.children;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue