Hide clear cache and reload button if crash is before client init (#7242)

This commit is contained in:
Michael Telatynski 2021-12-01 10:54:14 +00:00 committed by GitHub
parent 5ba2d16ee1
commit a4714829f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -106,13 +106,19 @@ export default class ErrorBoundary extends React.PureComponent<{}, IState> {
</React.Fragment>;
}
let clearCacheButton: JSX.Element;
// we only show this button if there is an initialised MatrixClient otherwise we can't clear the cache
if (MatrixClientPeg.get()) {
clearCacheButton = <AccessibleButton onClick={this.onClearCacheAndReload} kind='danger'>
{ _t("Clear cache and reload") }
</AccessibleButton>;
}
return <div className="mx_ErrorBoundary">
<div className="mx_ErrorBoundary_body">
<h1>{ _t("Something went wrong!") }</h1>
{ bugReportSection }
<AccessibleButton onClick={this.onClearCacheAndReload} kind='danger'>
{ _t("Clear cache and reload") }
</AccessibleButton>
{ clearCacheButton }
</div>
</div>;
}