[Glitch] Deep compare tags for hashtag column reload

Port 98c9ad366b to glitch-soc
lolsob-rspec
Thibaut Girka 2018-12-18 18:05:29 +01:00 committed by ThibG
parent 423c953518
commit 0cac543474
1 changed files with 2 additions and 1 deletions

View File

@ -9,6 +9,7 @@ import { expandHashtagTimeline, clearTimeline } from 'flavours/glitch/actions/ti
import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns'; import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; import { connectHashtagStream } from 'flavours/glitch/actions/streaming';
import { isEqual } from 'lodash';
const mapStateToProps = (state, props) => ({ const mapStateToProps = (state, props) => ({
hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0, hasUnread: state.getIn(['timelines', `hashtag:${props.params.id}`, 'unread']) > 0,
@ -99,7 +100,7 @@ export default class HashtagTimeline extends React.PureComponent {
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {
const { dispatch, params } = this.props; const { dispatch, params } = this.props;
const { id, tags } = nextProps.params; const { id, tags } = nextProps.params;
if (id !== params.id || tags !== params.tags) { if (id !== params.id || !isEqual(tags, params.tags)) {
this._unsubscribe(); this._unsubscribe();
this._subscribe(dispatch, id, tags); this._subscribe(dispatch, id, tags);
this.props.dispatch(clearTimeline(`hashtag:${id}`)); this.props.dispatch(clearTimeline(`hashtag:${id}`));