Skip to content

Commit e3f1835

Browse files
committed
Load manifests provided by the imported configuration
1 parent 8dae6b6 commit e3f1835

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

__tests__/src/reducers/manifests.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,10 @@ describe('manifests reducer', () => {
9494
type: ActionTypes.IMPORT_MIRADOR_STATE,
9595
})).toEqual({ new: 'stuff' });
9696
});
97+
it('should handle IMPORT_CONFIG setting to load manifests', () => {
98+
expect(manifestsReducer({}, {
99+
config: { manifests: { new: 'stuff' } },
100+
type: ActionTypes.IMPORT_CONFIG,
101+
})).toEqual({ new: 'stuff' });
102+
});
97103
});

src/state/reducers/manifests.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import omit from 'lodash/omit';
2+
import deepmerge from 'deepmerge';
23
import ActionTypes from '../actions/action-types';
34

45
/**
@@ -36,6 +37,9 @@ export const manifestsReducer = (state = {}, action) => {
3637
isFetching: false,
3738
},
3839
};
40+
case ActionTypes.UPDATE_CONFIG:
41+
case ActionTypes.IMPORT_CONFIG:
42+
return deepmerge(state, action.config.manifests || {});
3943
case ActionTypes.REMOVE_MANIFEST:
4044
return Object.keys(state).reduce((object, key) => {
4145
if (key !== action.manifestId) {

0 commit comments

Comments
 (0)