Commit 27e1c236 authored by David Redondo's avatar David Redondo 🏎
Browse files

Use some() for searching in list of model indices

includes() compares for equality, two objects are only equal if both reference
the same object. The active task model index is not necessarily the same as the
indx corresponding to it in the list because they are created seperately.
Alternatively we can just check if some index in the list is active.
parent ad97508a
......@@ -127,7 +127,7 @@ function activateTask(index, model, modifiers, task) {
// If the active task is from a different app from the group that
// was clicked on switch to the last-used task from that app.
if (!childTaskList.includes(tasksModel.activeTask)) {
if (!childTaskList.some(index => tasksModel.data(index, TaskManager.AbstractTasksModel.IsActive))) {
tasksModel.requestActivate(lastUsedTask);
} else {
// If the active task is already among in the group that was
......@@ -136,7 +136,7 @@ function activateTask(index, model, modifiers, task) {
// every click.
for (let j = 0; j < childTaskList.length; ++j) {
const childTask = childTaskList[j];
if (childTask == tasksModel.activeTask) {
if (tasksModel.data(childTask, TaskManager.AbstractTasksModel.IsActive)) {
// Found the current task. Activate the next one
let nextTask = j + 1;
if (nextTask >= childTaskList.length) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment