Skip to content

Commit

Permalink
controllers: Fix PluginController._filterMemStoreState
Browse files Browse the repository at this point in the history
It was overwriting the "plugins" key with an empty object instead of
merging new plugins into it.
  • Loading branch information
rekmarks committed Apr 4, 2021
1 parent f8cbb1c commit 7792ca7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/controllers/src/plugins/PluginController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,13 @@ export class PluginController extends EventEmitter {
): Partial<PluginControllerMemState> {
const memState: Partial<PluginControllerMemState> = {
...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<Plugin>).sourceCode;
Expand Down

0 comments on commit 7792ca7

Please sign in to comment.