Loading Delay

Sometimes, when the request returns fast enough, loading may complete the state switching false -> true -> false in a short time. At this time, the loading animation may flicker (especially the animation that fills the entire screen), which will bring a bad user experience.

So the best way is to set a delay value. When the waiting time is greater than the delay value, loading will be set to true, as shown below.

Of course, there are no absolutes in the world. If we set loadingDelay to 500ms, my request is completed in 510ms still unavoidable at this time There will be flickering.

Last Updated: 6/6/2023, 4:05:10 AM
Contributors: John