From dce3a410257c5657c6983df22e95d6d0bee757c7 Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Mon, 20 Mar 2017 18:25:44 +0100 Subject: [PATCH 1/2] Fix #1610. Now the epics are overridable --- web/client/plugins/Search.jsx | 2 +- web/client/utils/PluginsUtils.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/client/plugins/Search.jsx b/web/client/plugins/Search.jsx index 2232e22017..145a92cd59 100644 --- a/web/client/plugins/Search.jsx +++ b/web/client/plugins/Search.jsx @@ -192,7 +192,7 @@ module.exports = { priority: 1 } }), - epics: [searchEpic, searchItemSelected], + epics: {searchEpic, searchItemSelected}, reducers: { search: require('../reducers/search'), mapInfo: require('../reducers/mapInfo') diff --git a/web/client/utils/PluginsUtils.js b/web/client/utils/PluginsUtils.js index d2c3ceddb6..631c00de62 100644 --- a/web/client/utils/PluginsUtils.js +++ b/web/client/utils/PluginsUtils.js @@ -120,7 +120,7 @@ const getPluginItems = (state, plugins, pluginsConfig, name, id, isDefault, load const getReducers = (plugins) => Object.keys(plugins).map((name) => plugins[name].reducers) .reduce((previous, current) => assign({}, previous, current), {}); const getEpics = (plugins) => Object.keys(plugins).map((name) => plugins[name].epics) - .reduce((previous = [], current = []) => [ ...previous, ...current], []); + .reduce((previous = [], current = []) => assign({}, previous, current), {}); const PluginsUtils = { combineReducers: (plugins, reducers) => { const pluginsReducers = getReducers(plugins); @@ -128,7 +128,7 @@ const PluginsUtils = { }, combineEpics: (plugins, epics = []) => { const pluginEpics = getEpics(plugins); - return combineEpics(...[ ...pluginEpics, ...epics]); + return combineEpics(...[ ...Object.keys(pluginEpics).map(k => pluginEpics[k]), ...epics]); }, getReducers, filterState, From b19b1f01b836c8fe24faf23902be55a9da4a4004 Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Tue, 21 Mar 2017 10:55:59 +0100 Subject: [PATCH 2/2] removed defaults for reduce --- web/client/utils/PluginsUtils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/utils/PluginsUtils.js b/web/client/utils/PluginsUtils.js index 631c00de62..09e87849df 100644 --- a/web/client/utils/PluginsUtils.js +++ b/web/client/utils/PluginsUtils.js @@ -120,7 +120,7 @@ const getPluginItems = (state, plugins, pluginsConfig, name, id, isDefault, load const getReducers = (plugins) => Object.keys(plugins).map((name) => plugins[name].reducers) .reduce((previous, current) => assign({}, previous, current), {}); const getEpics = (plugins) => Object.keys(plugins).map((name) => plugins[name].epics) - .reduce((previous = [], current = []) => assign({}, previous, current), {}); + .reduce((previous, current) => assign({}, previous, current), {}); const PluginsUtils = { combineReducers: (plugins, reducers) => { const pluginsReducers = getReducers(plugins);