From f0e70d7855f908a2c5737e6a3dcec76502768267 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 13 Mar 2018 23:32:53 -0400 Subject: [PATCH] Update when server/socket changes --- src/ui/torrent_details.js | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/ui/torrent_details.js b/src/ui/torrent_details.js index 940e5d3..527fafc 100644 --- a/src/ui/torrent_details.js +++ b/src/ui/torrent_details.js @@ -37,13 +37,15 @@ function basename(path) { class File extends Component { shouldComponentUpdate(nextProps, _) { - return nextProps.file !== this.props.file; + return nextProps.file !== this.props.file + || nextProps.server !== this.props.server + || nextProps.socket !== this.props.socket; } render() { - const { dispatch, file } = this.props; - const { uri } = store.getState().socket; - const { download_token } = store.getState().server; + const { dispatch, file, server, socket } = this.props; + const { download_token } = server; + const { uri } = socket; return (
s[0].toUpperCase() + s.slice(1); if (!torrent || !files) { @@ -254,7 +264,12 @@ class Torrent extends Component { {this.state.filesShown ? files.slice() .sort((a, b) => a.path.localeCompare(b.path)) - .map(file => ) + .map(file => ) : null}
@@ -390,6 +405,8 @@ class TorrentDetails extends Component { trackers, peers, selection, + server, + socket, dispatch } = this.props; const index_by_tid = (res) => { @@ -416,6 +433,8 @@ class TorrentDetails extends Component { files={_files[id] || []} trackers={_trackers[id] || []} peers={_peers[id] || []} + server={server} + socket={socket} key={id} />)} {selection.length > 3 ? @@ -437,5 +456,6 @@ export default connect(state => ({ trackers: state.trackers, peers: state.peers, selection: state.selection, - server: state.server + server: state.server, + socket: state.socket, }))(TorrentDetails);