TabbyML / tabby

Self-hosted AI coding assistant
https://tabby.tabbyml.com/
Other
18.28k stars 771 forks source link

fix(ui): stop button display after loading #2427

Closed wwayne closed 2 weeks ago

wwayne commented 2 weeks ago

Context

Show stop button setShowStop(true) after 1500ms when isLoading is true. However, a bug could occur if isLoading changes to false within those 1500ms.

Fix

I used useLatest(isLoading) to double-check the isLoading state before showing the stop button.

liangfung commented 2 weeks ago

What is the reason for waiting 1500ms before displaying the stop button?

wwayne commented 2 weeks ago

@liangfung only because I feel it is better on UX

wwayne commented 2 weeks ago

Reduced to 300ms for better UX based on @liangfung's suggestion