Implement mid-task UI updates#1388
Conversation
|
📦 Package Size: 7132 KB |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## clack-renderer-feature #1388 +/- ##
==========================================================
- Coverage 82.41% 81.82% -0.59%
==========================================================
Files 243 241 -2
Lines 4624 4562 -62
Branches 1310 1290 -20
==========================================================
- Hits 3811 3733 -78
- Misses 700 715 +15
- Partials 113 114 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
474965e to
540e8c3
Compare
jwir3
left a comment
There was a problem hiding this comment.
One minor comment, otherwise LGTM!
| */ | ||
| function makeReporter(ctx: Context, renderer: TaskRenderer): TaskReporter { | ||
| return (update) => { | ||
| if (update.title !== undefined) ctx.title = update.title; |
There was a problem hiding this comment.
Personally, I'm not a big fan of single-line if statements, but I won't hold up review for this. Also, this could be simplified to if (update.title), unless there's some explicit reason you want to test for not undefined.
There was a problem hiding this comment.
It's just to match Listr semantics. Our previous tasks would update the ctx.title in this way too (i.e., allowing the empty string). I'm not sure it will ever be used anywhere, but the individual renderers can decide what to do with the information.
a49f8f1
into
clack-renderer-feature
Description
This PR adds support for tasks to make mid-task UI updates through the task's
TaskRenderer.updatecall, by handing the task areportcallback in its dependencies. This will be used to support textual-only updates (likegitInfonoting in the UI that it's skipping a build before calling the skip build GQL mutation) and numeric updates for things like uploading files or taking snapshots (these numeric updates will only work with certainTaskRendererimplementations; currently planning a progress bar renderer, but it's not yet implemented).Manual QA
This isn't wired up to any migrated tasks yet, so there's not much to test, but I did verify builds still work, and went through the existing auth pending, success, and failure modes. They all still work as expected. The real QA for this will come in the PR that migrates the
gitInfotask, which uses this update hook.📦 Published PR as canary version:
17.4.1--canary.1388.27279488773.0✨ Test out this PR locally via:
npm install chromatic@17.4.1--canary.1388.27279488773.0 # or yarn add chromatic@17.4.1--canary.1388.27279488773.0