Skip to content

Commit ba09a9c

Browse files
runway-github[bot]FrederikBoldingtommasiniNicolasMassart
authored andcommitted
chore(runway): cherry-pick fix: cp-7.53.0 Properly stop Snaps when clearing state (#17926)
- fix: cp-7.53.0 Properly stop Snaps when clearing state (#17810) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Properly stop Snaps when clearing state. Patching in a fix from MetaMask/snaps#3552 because mobile is a few versions behind on `snaps-controllers`. [a17c422](a17c422) Co-authored-by: Frederik Bolding <[email protected]> Co-authored-by: tommasini <[email protected]> Co-authored-by: Nico MASSART <[email protected]>
1 parent cc6a323 commit ba09a9c

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)