Only redirect to a stored tab if it still exists
This commit is contained in:
parent
962f7d1eb0
commit
3af6ad9cd9
File diff suppressed because one or more lines are too long
@ -23,8 +23,10 @@ export default function initialState({ store }) {
|
||||
if (tab) {
|
||||
const [server, name = null] = tab.split(/;(.+)/);
|
||||
|
||||
if (find(env.servers, srv => srv.host === server)) {
|
||||
if (name && find(env.channels, chan => chan.name === name)) {
|
||||
store.dispatch(select(server, name, true));
|
||||
} else if (find(env.servers, srv => srv.host === server)) {
|
||||
store.dispatch(select(server, null, true));
|
||||
} else {
|
||||
store.dispatch(updateSelection());
|
||||
}
|
||||
|
@ -52,6 +52,10 @@ export function measureScrollBarWidth() {
|
||||
}
|
||||
|
||||
export function find(arr, pred) {
|
||||
if (!arr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (pred(arr[i])) {
|
||||
return arr[i];
|
||||
|
Loading…
Reference in New Issue
Block a user