Skip to content

Commit 3fd34e5

Browse files
committed
Fix composable-controller allowlist error by assigning messenger to its own variable
See MetaMask/core#4033
1 parent 2e9a554 commit 3fd34e5

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

app/core/Engine.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,12 +1354,8 @@ class Engine {
13541354
}
13551355
}
13561356

1357-
this.datamodel = new ComposableController<
1358-
EngineState,
1359-
Controllers[keyof Controllers]
1360-
>({
1361-
controllers,
1362-
messenger: this.controllerMessenger.getRestricted({
1357+
const composableControllerMessenger =
1358+
this.controllerMessenger.getRestricted({
13631359
name: 'ComposableController',
13641360
allowedActions: [],
13651361
// Add `stateChange` event here and in the `GlobalEvents` type
@@ -1385,7 +1381,13 @@ class Engine {
13851381
'SnapController:stateChange',
13861382
'SubjectMetadataController:stateChange',
13871383
],
1388-
}),
1384+
});
1385+
this.datamodel = new ComposableController<
1386+
EngineState,
1387+
Controllers[keyof Controllers]
1388+
>({
1389+
controllers,
1390+
messenger: composableControllerMessenger,
13891391
});
13901392
this.context = controllers.reduce<Partial<typeof this.context>>(
13911393
(context, controller) => ({

0 commit comments

Comments
 (0)