Skip to content

Commit

Permalink
fix(watch): display which tasks will be rerun (#8960)
Browse files Browse the repository at this point in the history
Added a "restart tasks" event sent from watch which will declare all new
tasks that need to be rerun.

Also has a bug fix for `update_tasks` where a selected task could get
removed from the list resulting in a crash. We now gracefully reset the
scroll if a user selected a task that got removed.

Added unit tests for new behavior.
  • Loading branch information
chris-olszewski authored and NicholasLYang committed Aug 19, 2024
1 parent 5baacdf commit 98a0382
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions crates/turborepo-ui/src/tui/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ impl<W> App<W> {
self.scroll.select(Some(0));
self.selected_task_index = 0;
}
<<<<<<< HEAD

pub fn resize(&mut self, rows: u16, cols: u16) {
self.size.resize(rows, cols);
Expand All @@ -384,6 +385,9 @@ impl<W> App<W> {
term.resize(pane_rows, pane_cols);
})
}
||||||| parent of 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
=======
>>>>>>> 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
}

impl<W: Write> App<W> {
Expand Down Expand Up @@ -619,10 +623,15 @@ fn update(
app.copy_selection();
}
Event::RestartTasks { tasks } => {
<<<<<<< HEAD
app.restart_tasks(tasks);
}
Event::Resize { rows, cols } => {
app.resize(rows, cols);
||||||| parent of 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
=======
app.update_tasks(tasks);
>>>>>>> 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
}
}
Ok(None)
Expand Down Expand Up @@ -928,6 +937,7 @@ mod test {
"selected b"
);
}
<<<<<<< HEAD

#[test]
fn test_resize() {
Expand Down Expand Up @@ -986,4 +996,7 @@ mod test {

app.start_task("d", OutputLogs::Full).unwrap();
}
||||||| parent of 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
=======
>>>>>>> 90f8a5566b (fix(watch): display which tasks will be rerun (#8960))
}

0 comments on commit 98a0382

Please sign in to comment.