Fix Notepad render loop and stabilize toolbox modules
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
Some checks failed
Deploy Sokko G / deploy (push) Failing after 2s
This commit is contained in:
parent
c096cc07fe
commit
6c61e11f9a
8 changed files with 118 additions and 94 deletions
31
website/src/components/AppErrorBoundary.jsx
Normal file
31
website/src/components/AppErrorBoundary.jsx
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Rôle : récupère les erreurs de rendu et de chargement lazy au niveau de l'application.
|
||||
import { Component } from "react";
|
||||
|
||||
export class AppErrorBoundary extends Component {
|
||||
state = { error: null };
|
||||
|
||||
static getDerivedStateFromError(error) {
|
||||
return { error };
|
||||
}
|
||||
|
||||
componentDidUpdate(previousProps) {
|
||||
if (previousProps.route !== this.props.route && this.state.error) {
|
||||
this.setState({ error: null });
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.state.error) return this.props.children;
|
||||
return (
|
||||
<main className="startup-error">
|
||||
<section className="empty nds-empty-state" role="alert">
|
||||
<h1>Cette page n'a pas pu être affichée</h1>
|
||||
<p>Une erreur est survenue pendant le chargement de cet outil.</p>
|
||||
<button className="nds-button" data-size="sm" type="button" onClick={() => window.location.reload()}>
|
||||
Recharger la page
|
||||
</button>
|
||||
</section>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue