Skip to content

Commit 2c2b75c

Browse files
authored
Merge branch 'develop' into extract-crypto-compare-API
2 parents 0c67c45 + af700d8 commit 2c2b75c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/approval/ApprovalController.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,14 @@ export class ApprovalController extends BaseController<ApprovalConfig, ApprovalS
395395
approval.requestData = requestData;
396396
}
397397

398+
const approvals = {
399+
...this.state[APPROVALS_STORE_KEY],
400+
[id]: approval,
401+
};
402+
398403
this.update({
399-
[APPROVALS_STORE_KEY]: {
400-
...this.state[APPROVALS_STORE_KEY],
401-
[id]: approval,
402-
},
403-
[APPROVAL_COUNT_STORE_KEY]: this.state[APPROVAL_COUNT_STORE_KEY] + 1,
404+
[APPROVALS_STORE_KEY]: approvals,
405+
[APPROVAL_COUNT_STORE_KEY]: Object.keys(approvals).length,
404406
}, true);
405407
}
406408

@@ -427,7 +429,7 @@ export class ApprovalController extends BaseController<ApprovalConfig, ApprovalS
427429
delete newApprovals[id];
428430
this.update({
429431
[APPROVALS_STORE_KEY]: newApprovals,
430-
[APPROVAL_COUNT_STORE_KEY]: this.state[APPROVAL_COUNT_STORE_KEY] - 1,
432+
[APPROVAL_COUNT_STORE_KEY]: Object.keys(newApprovals).length,
431433
}, true);
432434
}
433435

0 commit comments

Comments
 (0)