From 1fa3586db5d2e56480536377fea8bc52672e0516 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sun, 27 May 2018 17:10:48 +0200 Subject: [Glitch] Use streaming API for standalone timelines on /about and /tag pages Port 0128b86d3098042cdbc3a1629f74b70f665f8dfb to glitch-soc --- .../glitch/features/standalone/hashtag_timeline/index.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js') diff --git a/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js b/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js index 0ad2cef80..39053bcc9 100644 --- a/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js +++ b/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js @@ -8,6 +8,7 @@ import { } from 'flavours/glitch/actions/timelines'; import Column from 'flavours/glitch/components/column'; import ColumnHeader from 'flavours/glitch/components/column_header'; +import { connectHashtagStream } from 'flavours/glitch/actions/streaming'; @connect() export default class HashtagTimeline extends React.PureComponent { @@ -29,16 +30,13 @@ export default class HashtagTimeline extends React.PureComponent { const { dispatch, hashtag } = this.props; dispatch(refreshHashtagTimeline(hashtag)); - - this.polling = setInterval(() => { - dispatch(refreshHashtagTimeline(hashtag)); - }, 10000); + this.disconnect = dispatch(connectHashtagStream(hashtag)); } componentWillUnmount () { - if (typeof this.polling !== 'undefined') { - clearInterval(this.polling); - this.polling = null; + if (this.disconnect) { + this.disconnect(); + this.disconnect = null; } } -- cgit