Don't navigate when deselecting due to navigation
This commit is contained in:
parent
cc414c9b57
commit
0050f12c65
|
@ -6,7 +6,7 @@ export const UNION = 'UNION';
|
||||||
export const SUBTRACT = 'SUBTRACT';
|
export const SUBTRACT = 'SUBTRACT';
|
||||||
export const EXCLUSIVE = 'EXCLUSIVE';
|
export const EXCLUSIVE = 'EXCLUSIVE';
|
||||||
|
|
||||||
export default function selectTorrent(ids, action) {
|
export default function selectTorrent(ids, action, navigate=true) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const previous = new Set(getState().selection);
|
const previous = new Set(getState().selection);
|
||||||
dispatch({ type: action, ids });
|
dispatch({ type: action, ids });
|
||||||
|
@ -56,11 +56,13 @@ export default function selectTorrent(ids, action) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (navigate) {
|
||||||
const url_torrents = state.selection.slice(0, 3);
|
const url_torrents = state.selection.slice(0, 3);
|
||||||
if (url_torrents.length > 0) {
|
if (url_torrents.length > 0) {
|
||||||
dispatch(push(`/torrents/${url_torrents}`));
|
dispatch(push(`/torrents/${url_torrents}`));
|
||||||
} else {
|
} else {
|
||||||
dispatch(push("/"));
|
dispatch(push("/"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,7 @@ class TorrentDetails extends Component {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
const { dispatch } = this.props;
|
const { dispatch } = this.props;
|
||||||
dispatch(selectTorrent([], EXCLUSIVE));
|
dispatch(selectTorrent([], EXCLUSIVE, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
renderHeader(selection) {
|
renderHeader(selection) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user