Closed wwayne closed 2 weeks ago
Show stop button setShowStop(true) after 1500ms when isLoading is true. However, a bug could occur if isLoading changes to false within those 1500ms.
setShowStop(true)
isLoading
I used useLatest(isLoading) to double-check the isLoading state before showing the stop button.
What is the reason for waiting 1500ms before displaying the stop button?
@liangfung only because I feel it is better on UX
Reduced to 300ms for better UX based on @liangfung's suggestion
Context
Show stop button
setShowStop(true)
after 1500ms whenisLoading
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.