don't update all timelines

This commit is contained in:
FloatingGhost 2022-12-08 14:50:38 +00:00
parent 076f7534db
commit 2358754bb3

View file

@ -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)));