From b6ba59ac513351b96470c1b023e7ee5deb53bb59 Mon Sep 17 00:00:00 2001 From: okbel Date: Tue, 20 Mar 2018 13:19:20 -0300 Subject: [PATCH 1/2] using the plugins service --- .../src/tabs/stream/containers/Stream.js | 3 --- client/coral-framework/components/Slot.js | 7 ------- client/coral-framework/services/plugins.js | 8 ++++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js index 1eae7d816..9687a9370 100644 --- a/client/coral-embed-stream/src/tabs/stream/containers/Stream.js +++ b/client/coral-embed-stream/src/tabs/stream/containers/Stream.js @@ -465,9 +465,6 @@ const mapStateToProps = state => ({ activeStreamTab: state.stream.activeTab, previousStreamTab: state.stream.previousTab, commentClassNames: state.stream.commentClassNames, - - // @Deprecated plugin_config - pluginsConfig: state.config.plugins_config || state.config.plugin_config, sortOrder: state.stream.sortOrder, sortBy: state.stream.sortBy, }); diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 0dea70e57..049d075ab 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -93,12 +93,6 @@ class Slot extends React.Component { children = children.map(childFactory); } - const debugProps = pluginsConfig.debug - ? { - 'data-slot-name': fill, - } - : {}; - return ( {children} diff --git a/client/coral-framework/services/plugins.js b/client/coral-framework/services/plugins.js index fbd2ae21f..8f9ad5b41 100644 --- a/client/coral-framework/services/plugins.js +++ b/client/coral-framework/services/plugins.js @@ -102,8 +102,16 @@ class PluginsService { get(reduxState, 'config.plugins_config') || get(reduxState, 'config.plugin_config') || emptyConfig; + + const debugProps = pluginsConfig.debug + ? { + 'data-slot-name': props.fill, + } + : {}; + return { ...props, + ...debugProps, config: pluginsConfig, ...(component.fragments ? pick(queryData, Object.keys(component.fragments)) From 6c35f02e6b722506fc89c902119d63a543977f15 Mon Sep 17 00:00:00 2001 From: okbel Date: Tue, 20 Mar 2018 13:50:28 -0300 Subject: [PATCH 2/2] changes --- client/coral-framework/components/Slot.js | 10 +++++++--- client/coral-framework/services/plugins.js | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 049d075ab..e6a3eda2d 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -8,6 +8,7 @@ import isEqual from 'lodash/isEqual'; import get from 'lodash/get'; import { getShallowChanges } from 'coral-framework/utils'; import omit from 'lodash/omit'; +import merge from 'lodash/merge'; const emptyConfig = {}; @@ -75,9 +76,10 @@ class Slot extends React.Component { // @Deprecated plugin_config const pluginsConfig = - get(reduxState, 'config.plugins_config') || - get(reduxState, 'config.plugin_config') || - emptyConfig; + merge( + get(reduxState, 'config.plugins_config'), + get(reduxState, 'config.plugin_config') + ) || emptyConfig; if (children.length === 0 && DefaultComponent) { const props = plugins.getSlotComponentProps( @@ -93,6 +95,8 @@ class Slot extends React.Component { children = children.map(childFactory); } + // console.log('pluginsConfig', pluginsConfig); + return (