don't update all timelines
This commit is contained in:
parent
076f7534db
commit
2358754bb3
1 changed files with 12 additions and 2 deletions
|
@ -79,11 +79,21 @@ export const connectTimelineStream = (timelineId, channelName, params = {}, opti
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
shouldUpdate (timelineId, streamName) {
|
||||||
|
const stream = streamName[0];
|
||||||
|
if (timelineId === 'home' && streamName.startsWith('user')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return timelineId === stream;
|
||||||
|
},
|
||||||
|
|
||||||
onReceive (data) {
|
onReceive (data) {
|
||||||
console.log("recv", timelineId, data)
|
|
||||||
switch(data.event) {
|
switch(data.event) {
|
||||||
case 'update':
|
case 'update':
|
||||||
dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept));
|
if (this.shouldUpdate(timelineId, data.stream)) {
|
||||||
|
dispatch(updateTimeline(timelineId, JSON.parse(data.payload), options.accept));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'status.update':
|
case 'status.update':
|
||||||
dispatch(updateStatus(JSON.parse(data.payload)));
|
dispatch(updateStatus(JSON.parse(data.payload)));
|
||||||
|
|
Loading…
Reference in a new issue