Skip to content

Commit

Permalink
🎨 优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
CodFrm committed Jul 10, 2024
1 parent fcfb3ac commit feafd75
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/pages/options/routes/ScriptList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,9 @@ function ScriptList() {
loading={item.loading}
disabled={item.loading}
onChange={(checked) => {
setScriptList((list) => {
return list.map((script) => {
if (script.id === item.id) {
script.loading = true;
}
return script;
});
});
setScriptList((list) => {
const index = list.findIndex((script) => script.id === item.id);
list[index].loading = true;
let p: Promise<any>;
if (checked) {
p = scriptCtrl.enable(item.id).then(() => {
Expand Down

0 comments on commit feafd75

Please sign in to comment.