diff --git a/client/coral-embed-stream/src/components/Stream.js b/client/coral-embed-stream/src/components/Stream.js index 395ca8c3b..2a1381862 100644 --- a/client/coral-embed-stream/src/components/Stream.js +++ b/client/coral-embed-stream/src/components/Stream.js @@ -37,10 +37,18 @@ class Stream extends React.Component { this.setState({keepCommentBox: true}); } - if (next.activeStreamTab !== 'all') { - const slotPlugins = this.getSlotComponents('streamTabs', next).map((c) => c.talkPluginName); - if (slotPlugins.indexOf(next.activeStreamTab) === -1) { - next.setActiveStreamTab('all'); + this.fallbackAllTab(next); + } + + componentDidMount() { + this.fallbackAllTab(); + } + + fallbackAllTab(props = this.props) { + if (props.activeStreamTab !== 'all') { + const slotPlugins = this.getSlotComponents('streamTabs', props).map((c) => c.talkPluginName); + if (slotPlugins.indexOf(props.activeStreamTab) === -1) { + props.setActiveStreamTab('all'); } } } diff --git a/client/coral-embed-stream/src/reducers/stream.js b/client/coral-embed-stream/src/reducers/stream.js index 2bb8cf0d3..c624c0959 100644 --- a/client/coral-embed-stream/src/reducers/stream.js +++ b/client/coral-embed-stream/src/reducers/stream.js @@ -21,7 +21,7 @@ const initialState = { assetUrl: getQueryVariable('asset_url') || '', commentId: getQueryVariable('comment_id') || '', commentClassNames: [], - activeTab: 'all', + activeTab: process.env.TALK_DEFAULT_STEAM_TAB, previousTab: '', }; diff --git a/webpack.config.js b/webpack.config.js index 5c6655d17..395cf02a3 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -109,7 +109,8 @@ const config = { }), new webpack.EnvironmentPlugin({ 'TALK_PLUGINS_JSON': '{}', - 'TALK_THREADING_LEVEL': '3' + 'TALK_THREADING_LEVEL': '3', + 'TALK_DEFAULT_STEAM_TAB': 'all', }) ], resolveLoader: {