diff --git a/packages/controllers/src/plugins/PluginController.ts b/packages/controllers/src/plugins/PluginController.ts index ecea8ce56d..269b780291 100644 --- a/packages/controllers/src/plugins/PluginController.ts +++ b/packages/controllers/src/plugins/PluginController.ts @@ -197,11 +197,13 @@ export class PluginController extends EventEmitter { ): Partial { const memState: Partial = { ...newState, - plugins: {}, }; - // remove sourceCode from memState plugin objects if (newState.plugins) { + // Copy existing plugins to the new memState + memState.plugins = this.memStore.getState().plugins || {}; + + // Remove sourceCode from updated memState plugin objects Object.keys(newState.plugins).forEach((name) => { const plugin = { ...(newState as PluginControllerState).plugins[name] }; delete (plugin as Partial).sourceCode;