From 8fa9ed3d2b4b9b09b38a42382c1550e4d2337693 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Mon, 18 Jun 2018 16:14:22 +0300 Subject: [PATCH] fix(feed): fix feed live update --- src/app/feed.js | 9 +++++++++ translations/en.json | 3 ++- translations/ru.json | 3 ++- translations/ua.json | 3 ++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/feed.js b/src/app/feed.js index 92d94e0e..200beb4a 100644 --- a/src/app/feed.js +++ b/src/app/feed.js @@ -17,6 +17,15 @@ export default class RecentTorrents extends Component { this.forceUpdate(); } })) + this.feedFunc = ({feed}) => { + this.torrents = feed + this.forceUpdate() + }; + window.torrentSocket.on('feedUpdate', this.feedFunc); + } + componentWillUnmount() { + if(this.feedFunc) + window.torrentSocket.off('feedUpdate', this.feedFunc); } render() { return ( diff --git a/translations/en.json b/translations/en.json index c61df115..d407aa25 100644 --- a/translations/en.json +++ b/translations/en.json @@ -163,6 +163,7 @@ "Activity": "Activity", "downloading": "downloading", "Cancel download": "Cancel download", - "Back to previus": "Back to previus" + "Back to previus": "Back to previus", + "Processing files": "Processing files" } } \ No newline at end of file diff --git a/translations/ru.json b/translations/ru.json index 5220a1a0..7993a7d3 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -163,6 +163,7 @@ "Activity": "Активность", "downloading": "скачивается", "Cancel download": "Отвенить закачку", - "Back to previus": "Вернуться на предыдущую" + "Back to previus": "Вернуться на предыдущую", + "Processing files": "Обработка файлов" } } \ No newline at end of file diff --git a/translations/ua.json b/translations/ua.json index 551b10b8..aac2252e 100644 --- a/translations/ua.json +++ b/translations/ua.json @@ -163,6 +163,7 @@ "Activity": "Activity", "downloading": "downloading", "Cancel download": "Cancel download", - "Back to previus": "Back to previus" + "Back to previus": "Back to previus", + "Processing files": "Processing files" } } \ No newline at end of file