Skip to content

Commit e68c20a

Browse files
fix: Properly stop Snaps when clearing state
1 parent 390dee8 commit e68c20a

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/node_modules/@metamask/snaps-controllers/dist/snaps/SnapController.cjs b/node_modules/@metamask/snaps-controllers/dist/snaps/SnapController.cjs
2+
index 908f4e7..8f66c3f 100644
3+
--- a/node_modules/@metamask/snaps-controllers/dist/snaps/SnapController.cjs
4+
+++ b/node_modules/@metamask/snaps-controllers/dist/snaps/SnapController.cjs
5+
@@ -963,12 +963,7 @@ class SnapController extends base_controller_1.BaseController {
6+
*/
7+
async clearState() {
8+
const snapIds = Object.keys(this.state.snaps);
9+
- if (this.#closeAllConnections) {
10+
- snapIds.forEach((snapId) => {
11+
- this.#closeAllConnections?.(snapId);
12+
- });
13+
- }
14+
- await this.messagingSystem.call('ExecutionService:terminateAllSnaps');
15+
+ await this.stopAllSnaps();
16+
snapIds.forEach((snapId) => this.#revokeAllSnapPermissions(snapId));
17+
this.update((state) => {
18+
state.snaps = {};

0 commit comments

Comments
 (0)