File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
packages/composable-controller/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import type {
5
5
BaseState ,
6
6
BaseConfig ,
7
7
} from '@metamask/base-controller' ;
8
- import type { Json } from '@metamask/utils' ;
8
+ import { isValidJson , type Json } from '@metamask/utils' ;
9
9
10
10
export const controllerName = 'ComposableController' ;
11
11
@@ -156,10 +156,12 @@ export class ComposableController extends BaseController<
156
156
} ) ;
157
157
} else if ( isBaseController ( controller ) ) {
158
158
this . messagingSystem . subscribe ( `${ name } :stateChange` , ( childState ) => {
159
- this . update ( ( state ) => ( {
160
- ...state ,
161
- [ name ] : childState ,
162
- } ) ) ;
159
+ if ( isValidJson ( childState ) ) {
160
+ this . update ( ( state ) => ( {
161
+ ...state ,
162
+ [ name ] : childState ,
163
+ } ) ) ;
164
+ }
163
165
} ) ;
164
166
} else {
165
167
throw new Error (
You can’t perform that action at this time.
0 commit comments