diff --git a/client/source/scripts/components/modals/SettingsModal.js b/client/source/scripts/components/modals/SettingsModal.js index 55b6af1a..0624a7ab 100644 --- a/client/source/scripts/components/modals/SettingsModal.js +++ b/client/source/scripts/components/modals/SettingsModal.js @@ -40,7 +40,6 @@ export default class SettingsModal extends React.Component { this.handleSettingsStoreChange); SettingsStore.listen(EventTypes.SETTINGS_SAVE_REQUEST_ERROR, this.handleSaveSettingsError); - SettingsStore.fetchFloodSettings('speedLimits'); } componentWillUnmount() { diff --git a/client/source/scripts/components/sidebar/SpeedLimitDropdown.js b/client/source/scripts/components/sidebar/SpeedLimitDropdown.js index a8cacc8b..8ba95033 100644 --- a/client/source/scripts/components/sidebar/SpeedLimitDropdown.js +++ b/client/source/scripts/components/sidebar/SpeedLimitDropdown.js @@ -30,7 +30,6 @@ class SpeedLimitDropdown extends React.Component { this.handleSettingsFetchRequestSuccess); TransferDataStore.listen(EventTypes.CLIENT_TRANSFER_DATA_REQUEST_SUCCESS, this.onTransferDataRequestSuccess); - SettingsStore.fetchFloodSettings('speedLimits'); TransferDataStore.fetchTransferData(); } diff --git a/client/source/scripts/components/torrent-list/ActionBar.js b/client/source/scripts/components/torrent-list/ActionBar.js index 02ae4a42..f4375b1c 100644 --- a/client/source/scripts/components/torrent-list/ActionBar.js +++ b/client/source/scripts/components/torrent-list/ActionBar.js @@ -40,7 +40,6 @@ export default class ActionBar extends React.Component { componentDidMount() { this.onSortChange(); SettingsStore.listen(EventTypes.SETTINGS_CHANGE, this.onSortChange); - SettingsStore.fetchFloodSettings('sortTorrents'); } componentWillUnmount() { diff --git a/client/source/scripts/components/torrent-list/SortDropdown.js b/client/source/scripts/components/torrent-list/SortDropdown.js index 8d5c130b..96560a5a 100644 --- a/client/source/scripts/components/torrent-list/SortDropdown.js +++ b/client/source/scripts/components/torrent-list/SortDropdown.js @@ -112,8 +112,7 @@ export default class SortDropdown extends React.Component { + menuItems={this.getDropdownMenus()} /> ); } } diff --git a/client/source/scripts/stores/SettingsStore.js b/client/source/scripts/stores/SettingsStore.js index e0daebad..92d92d5e 100644 --- a/client/source/scripts/stores/SettingsStore.js +++ b/client/source/scripts/stores/SettingsStore.js @@ -61,7 +61,6 @@ class SettingsStoreClass extends BaseStore { this.fetchStatus.clientSettingsFetched = true; this.clientSettings = settings; - this.emit(EventTypes.CLIENT_SETTINGS_FETCH_REQUEST_SUCCESS); this.processSettingsState(); } diff --git a/client/source/scripts/stores/TorrentFilterStore.js b/client/source/scripts/stores/TorrentFilterStore.js index 4a619399..a2137c26 100644 --- a/client/source/scripts/stores/TorrentFilterStore.js +++ b/client/source/scripts/stores/TorrentFilterStore.js @@ -48,6 +48,10 @@ class TorrentFilterStoreClass extends BaseStore { return this.torrentTrackerCount; } + handleFetchSettingsRequest() { + this.setTorrentsSort(SettingsStore.getFloodSettings('sortTorrents')); + } + handleSortPropsRequestSuccess(sortBy) { this.setTorrentsSort(sortBy); } @@ -131,6 +135,10 @@ TorrentFilterStore.dispatcherID = AppDispatcher.register((payload) => { case ActionTypes.CLIENT_FETCH_TORRENT_TRACKER_COUNT_REQUEST_ERROR: TorrentFilterStore.handleTorrentTrackerCountRequestError(action.error); break; + case ActionTypes.SETTINGS_FETCH_REQUEST_SUCCESS: + AppDispatcher.waitFor([SettingsStore.dispatcherID]); + TorrentFilterStore.handleFetchSettingsRequest(); + break; } }); diff --git a/client/source/scripts/stores/TorrentStore.js b/client/source/scripts/stores/TorrentStore.js index e6821fcc..4237a676 100644 --- a/client/source/scripts/stores/TorrentStore.js +++ b/client/source/scripts/stores/TorrentStore.js @@ -229,7 +229,7 @@ class TorrentStoreClass extends BaseStore { sortTorrents(torrents) { let torrentsSort = TorrentFilterStore.getTorrentsSort(); - this.torrents = torrents; + this.torrents = torrents || this.torrents; // Convert torrents hash to array and sort it. this.sortedTorrents = sortTorrents(this.torrents,