diff --git a/client/coral-embed-stream/src/containers/Stream.js b/client/coral-embed-stream/src/containers/Stream.js index 4df7fc960..4415f5f94 100644 --- a/client/coral-embed-stream/src/containers/Stream.js +++ b/client/coral-embed-stream/src/containers/Stream.js @@ -118,7 +118,9 @@ class StreamContainer extends React.Component { }; componentDidMount() { - this.props.data.refetch(); + if (this.props.previousTab) { + this.props.data.refetch(); + } this.countPoll = setInterval(() => { const {asset} = this.props.root; this.getCounts({ @@ -236,6 +238,7 @@ const mapStateToProps = state => ({ assetId: state.stream.assetId, assetUrl: state.stream.assetUrl, activeTab: state.embed.activeTab, + previousTab: state.embed.previousTab, }); const mapDispatchToProps = dispatch => diff --git a/client/coral-embed-stream/src/reducers/embed.js b/client/coral-embed-stream/src/reducers/embed.js index e7fe5a533..0fd661543 100644 --- a/client/coral-embed-stream/src/reducers/embed.js +++ b/client/coral-embed-stream/src/reducers/embed.js @@ -2,6 +2,7 @@ import * as actions from '../constants/embed'; const initialState = { activeTab: 'stream', + previousTab: '', }; export default function stream(state = initialState, action) { @@ -10,6 +11,7 @@ export default function stream(state = initialState, action) { return { ...state, activeTab: action.tab, + previousTab: state.activeTab, }; default: return state;