Skip to content

Commit

Permalink
🐛 修复删除Userconfig后主页还是会显示的问题 #285
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Jul 8, 2024
1 parent 013a4f6 commit dd3b1b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/app/service/script/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export default class ScriptEventListener {
script.selfMetadata = oldScript.selfMetadata;
}
}
// 判断一些undefined的字段
if (!script.config) {
script.config = undefined;
}
return new Promise((resolve, reject) => {
this.dao.save(script).then(
() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/options/routes/script/ScriptEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ const emptyScript = async (template: string, hotKeys: any, target?: string) => {
type visibleItem = "scriptStorage" | "scriptSetting" | "scriptResource";

const popstate = () => {
// eslint-disable-next-line no-restricted-globals
// eslint-disable-next-line no-restricted-globals, no-alert
if (confirm("脚本已修改, 离开后会丢失修改, 是否继续?")) {
window.history.back();
window.removeEventListener("popstate", popstate);
Expand Down

0 comments on commit dd3b1b4

Please sign in to comment.