|
|
@@ -2,12 +2,9 @@
|
|
|
|
|
|
import React from "react";
|
|
|
import { IconButton } from "./button";
|
|
|
-import GithubIcon from "../icons/github.svg";
|
|
|
import ResetIcon from "../icons/reload.svg";
|
|
|
-import { ISSUE_URL } from "../constant";
|
|
|
import Locale from "../locales";
|
|
|
-import { showConfirm } from "./ui-lib";
|
|
|
-import { useSyncStore } from "../store/sync";
|
|
|
+
|
|
|
|
|
|
interface IErrorBoundaryState {
|
|
|
hasError: boolean;
|
|
|
@@ -27,12 +24,9 @@ export class ErrorBoundary extends React.Component<any, IErrorBoundaryState> {
|
|
|
}
|
|
|
|
|
|
clearAndSaveData() {
|
|
|
- try {
|
|
|
- useSyncStore.getState().export();
|
|
|
- } finally {
|
|
|
- localStorage.clear();
|
|
|
- location.reload();
|
|
|
- }
|
|
|
+ // 直接清除数据,不下载备份
|
|
|
+ localStorage.clear();
|
|
|
+ location.reload();
|
|
|
}
|
|
|
|
|
|
render() {
|
|
|
@@ -46,21 +40,12 @@ export class ErrorBoundary extends React.Component<any, IErrorBoundaryState> {
|
|
|
<code>{this.state.info?.componentStack}</code>
|
|
|
</pre>
|
|
|
|
|
|
- <div style={{ display: "flex", justifyContent: "space-between" }}>
|
|
|
- <a href={ISSUE_URL} className="report">
|
|
|
- <IconButton
|
|
|
- text="Report This Error"
|
|
|
- icon={<GithubIcon />}
|
|
|
- bordered
|
|
|
- />
|
|
|
- </a>
|
|
|
+ <div style={{ display: "flex", justifyContent: "center" }}>
|
|
|
<IconButton
|
|
|
icon={<ResetIcon />}
|
|
|
text="Clear All Data"
|
|
|
- onClick={async () => {
|
|
|
- if (await showConfirm(Locale.Settings.Danger.Reset.Confirm)) {
|
|
|
- this.clearAndSaveData();
|
|
|
- }
|
|
|
+ onClick={() => {
|
|
|
+ this.clearAndSaveData();
|
|
|
}}
|
|
|
bordered
|
|
|
/>
|