Skip to content

Commit

Permalink
Load manifests provided by the imported configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Apr 8, 2022
1 parent 8dae6b6 commit e694e65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions __tests__/src/reducers/manifests.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,10 @@ describe('manifests reducer', () => {
type: ActionTypes.IMPORT_MIRADOR_STATE,
})).toEqual({ new: 'stuff' });
});
it('should handle IMPORT_CONFIG setting to load manifests', () => {
expect(manifestsReducer({}, {
config: { manifests: { new: 'stuff' } },
type: ActionTypes.IMPORT_CONFIG,
})).toEqual({ new: 'stuff' });
});
});
4 changes: 4 additions & 0 deletions src/state/reducers/manifests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import omit from 'lodash/omit';
import deepmerge from 'deepmerge';
import ActionTypes from '../actions/action-types';

/**
Expand Down Expand Up @@ -36,6 +37,9 @@ export const manifestsReducer = (state = {}, action) => {
isFetching: false,
},
};
case ActionTypes.UPDATE_CONFIG:
case ActionTypes.IMPORT_CONFIG:
return deepmerge(state, action.config.manifests);
case ActionTypes.REMOVE_MANIFEST:
return Object.keys(state).reduce((object, key) => {
if (key !== action.manifestId) {
Expand Down

0 comments on commit e694e65

Please sign in to comment.