Commit f773b89
authored
Adds a spinner when performing a lazy install (#275)
Most Yarn commands now silently run installs under the hood when they
detect the project isn't in sync compared to the last modification time
of package.json. Only problem is that it's a little _too_ silent and it
may look like the command is unexpectedly hanging.
To address this we now display a spinner if the install takes more than
200ms.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches the async lazy-install control flow with a new
`tokio::select!` timing branch and threaded terminal output, which could
affect install completion timing or terminal behavior in edge cases.
>
> **Overview**
> Improves UX for `lazy_install` by showing a spinner message
("Installing dependencies...") **only when running in a TTY** and the
install hasn’t finished within ~200ms; non-terminal contexts still run
silently.
>
> Refactors `lazy_install` to pin the install future, race it against a
short sleep via `tokio::select!`, start/stop a `start_progress` spinner
around the remaining work, and updates the progress thread to flush
immediately after hiding the cursor to make terminal state changes
visible promptly.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
328144f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 93452b3 commit f773b89
2 files changed
Lines changed: 37 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
80 | 81 | | |
81 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
764 | 764 | | |
765 | 765 | | |
766 | 766 | | |
767 | | - | |
| 767 | + | |
768 | 768 | | |
769 | 769 | | |
770 | 770 | | |
| |||
774 | 774 | | |
775 | 775 | | |
776 | 776 | | |
777 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
778 | 805 | | |
779 | 806 | | |
780 | 807 | | |
| |||
0 commit comments