Skip to content

Adds a spinner when performing a lazy install#275

Merged
arcanis merged 1 commit intomainfrom
mael/lazy-install-spinner
Apr 8, 2026
Merged

Adds a spinner when performing a lazy install#275
arcanis merged 1 commit intomainfrom
mael/lazy-install-spinner

Conversation

@arcanis
Copy link
Copy Markdown
Member

@arcanis arcanis commented Apr 8, 2026

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.


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.

Reviewed by Cursor Bugbot for commit 328144f. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

⏱️ Benchmark Results

gatsby install-full-cold

Metric Base Head Difference
Mean 2.420s 2.405s -0.62% ✅
Median 2.422s 2.407s -0.65% ✅
Min 2.386s 2.360s
Max 2.447s 2.444s
Std Dev 0.013s 0.016s
📊 Raw benchmark data (gatsby install-full-cold)

Base times: 2.415s, 2.433s, 2.420s, 2.439s, 2.411s, 2.424s, 2.433s, 2.424s, 2.432s, 2.436s, 2.424s, 2.447s, 2.425s, 2.429s, 2.411s, 2.410s, 2.416s, 2.426s, 2.427s, 2.405s, 2.394s, 2.416s, 2.421s, 2.413s, 2.419s, 2.412s, 2.427s, 2.404s, 2.425s, 2.386s

Head times: 2.412s, 2.399s, 2.394s, 2.394s, 2.396s, 2.417s, 2.405s, 2.408s, 2.383s, 2.360s, 2.403s, 2.397s, 2.391s, 2.380s, 2.394s, 2.402s, 2.410s, 2.414s, 2.444s, 2.399s, 2.414s, 2.414s, 2.408s, 2.417s, 2.413s, 2.421s, 2.426s, 2.420s, 2.415s, 2.399s


gatsby install-cache-and-lock (warm, with lockfile)

Metric Base Head Difference
Mean 0.355s 0.351s -1.02% ✅
Median 0.353s 0.351s -0.51% ✅
Min 0.345s 0.344s
Max 0.385s 0.369s
Std Dev 0.010s 0.004s
📊 Raw benchmark data (gatsby install-cache-and-lock (warm, with lockfile))

Base times: 0.353s, 0.348s, 0.350s, 0.352s, 0.349s, 0.352s, 0.352s, 0.352s, 0.349s, 0.352s, 0.355s, 0.353s, 0.355s, 0.356s, 0.355s, 0.357s, 0.350s, 0.357s, 0.354s, 0.355s, 0.384s, 0.345s, 0.350s, 0.346s, 0.347s, 0.385s, 0.376s, 0.355s, 0.364s, 0.345s

Head times: 0.349s, 0.350s, 0.350s, 0.352s, 0.348s, 0.348s, 0.358s, 0.344s, 0.352s, 0.355s, 0.351s, 0.351s, 0.347s, 0.349s, 0.348s, 0.348s, 0.350s, 0.350s, 0.351s, 0.348s, 0.351s, 0.369s, 0.353s, 0.356s, 0.353s, 0.354s, 0.351s, 0.354s, 0.352s, 0.353s

@arcanis
Copy link
Copy Markdown
Member Author

arcanis commented Apr 8, 2026

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 328144f. Configure here.

@arcanis arcanis merged commit f773b89 into main Apr 8, 2026
14 checks passed
@arcanis arcanis deleted the mael/lazy-install-spinner branch April 8, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant