Add a reload button to error boundary

There are sometimes edge cases on iOS which cause the app to crash,
it’s good to have a reload button as there’s no browser chrome (reload,
back, forward) in an iOS standalone PWA.
pull/751/head
nimbleghost 2023-06-17 22:15:02 +02:00
parent fafe478e5c
commit 9ba733d4e0
2 changed files with 7 additions and 2 deletions

View File

@ -389,6 +389,7 @@
"error_boundary_title": "Oh no, ntfy crashed", "error_boundary_title": "Oh no, ntfy crashed",
"error_boundary_description": "This should obviously not happen. Very sorry about this.<br/>If you have a minute, please <githubLink>report this on GitHub</githubLink>, or let us know via <discordLink>Discord</discordLink> or <matrixLink>Matrix</matrixLink>.", "error_boundary_description": "This should obviously not happen. Very sorry about this.<br/>If you have a minute, please <githubLink>report this on GitHub</githubLink>, or let us know via <discordLink>Discord</discordLink> or <matrixLink>Matrix</matrixLink>.",
"error_boundary_button_copy_stack_trace": "Copy stack trace", "error_boundary_button_copy_stack_trace": "Copy stack trace",
"error_boundary_button_reload_ntfy": "Reload ntfy",
"error_boundary_stack_trace": "Stack trace", "error_boundary_stack_trace": "Stack trace",
"error_boundary_gathering_info": "Gather more info …", "error_boundary_gathering_info": "Gather more info …",
"error_boundary_unsupported_indexeddb_title": "Private browsing not supported", "error_boundary_unsupported_indexeddb_title": "Private browsing not supported",

View File

@ -101,11 +101,15 @@ class ErrorBoundaryImpl extends React.Component {
}} }}
/> />
</p> </p>
<p> <div style={{ display: "flex", gap: 5 }}>
<Button variant="outlined" onClick={() => this.copyStack()}> <Button variant="outlined" onClick={() => this.copyStack()}>
{t("error_boundary_button_copy_stack_trace")} {t("error_boundary_button_copy_stack_trace")}
</Button> </Button>
</p>
<Button variant="outlined" onClick={() => window.location.reload()}>
{t("error_boundary_button_reload_ntfy")}
</Button>
</div>
<h3>{t("error_boundary_stack_trace")}</h3> <h3>{t("error_boundary_stack_trace")}</h3>
{this.state.niceStack ? ( {this.state.niceStack ? (
<pre>{this.state.niceStack}</pre> <pre>{this.state.niceStack}</pre>