progressbar.js icon indicating copy to clipboard operation
progressbar.js copied to clipboard

Uncaught promise error in 1.1.0

Open benjaminrancourt opened this issue 5 years ago • 13 comments

Hi,

Firstly, I want to thank you for your library, it adds a nice touch to our application. As I am a developer, it's sometime nice when we know how our creation is used, so I've attached a partial screenshot to show to you our use case.

Secondly, I encouters a little issue since I've upgrade progressbar.js from 1.0.1 to 1.1.0. In my browser console, there is sometime one or multiple uncaught promise errors:

Uncaught (in promise) {offset: 289.0670000019968}
Promise.then (async)		
animate	@	progressbar.js:1183
animate	@	progressbar.js:1406

It does'nt seem to affect the UI. Unfortunatly, I have not been able to find exactly why it occurs.

By by looking into the diffs from 1.0.1 to 1.1.0, I have been able to find that the error may be caused since the upgrade of the shifty dependency from the Pull Request #196 (commit).

By adding an empty catch function to R118-R121, the promise error is handled and it seem to not affect the UI. But, I'm not sure that it is the right way to fix this problem...

.catch(function(state) {})

I hope it helps you, thank you very much!


Screenshot_2019-10-30_13-43-15

benjaminrancourt avatar Oct 30 '19 17:10 benjaminrancourt

Thanks for reporting. Let's see if this is related to https://github.com/kimmobrunfeldt/progressbar.js/issues/256

kimmobrunfeldt avatar Nov 05 '19 18:11 kimmobrunfeldt

Will you please just catch it until you'll figure it out? its really hazardous..

Yahav avatar Dec 28 '19 11:12 Yahav

No solution yet?

asc0910 avatar Jan 31 '20 11:01 asc0910

Same problem here!

GianluigiMemoli avatar Mar 08 '20 20:03 GianluigiMemoli

Thanks for the fix. Here the command for installing from the commit:

npm install --save "git://github.com/Zellerich/progressbar.js.git#0978bd7a45c1e1fcc8cf9b0890caddb5362941f6

dmarman avatar Mar 21 '20 11:03 dmarman

Can you test the latest progressbar.js from latest master?

I think this should work similarly as @dmarman commented before:

npm install --save "git://github.com/kimmobrunfeldt/progressbar.js.git#master

kimmobrunfeldt avatar May 11 '20 21:05 kimmobrunfeldt

The root cause of the problem is that animate calls shifty tween multiple times before the previous animation is completed. Shifty expects the client to never do that, but progressbar.js doesn't put any protection in place. Part of the reason is because the error message and documentation aren't clear why that is happening (improvement here: https://github.com/jeremyckahn/shifty/pull/115)

The solution is to make sure to await progress.stop(true) (or await circle.stop(true)) the animation before animating again.

wparad avatar May 12 '20 15:05 wparad

FYI, I have incorporated @wparad's jeremyckahn/shifty#115 fix into the latest v.2.9.0 release.

Thank you @wparad!

jeremyckahn avatar May 13 '20 12:05 jeremyckahn

Is there any timeframe for having this issue solved?

mihaighigea avatar May 13 '20 18:05 mihaighigea

FYI, I have incorporated @wparad's jeremyckahn/shifty#115 fix into the latest v.2.9.0 release.

Thank you @wparad!

Now I'm having the stop() executed while tween isPlaying. error. Thanks wparad for changing the error mesage for us.

Is this repository abandoned?

the-turk avatar Jul 25 '20 15:07 the-turk

Just to get some clarity on the previous two comments, were they directed at @kimmobrunfeldt or myself?

jeremyckahn avatar Jul 26 '20 16:07 jeremyckahn

Just to get some clarity on the previous two comments, were they directed at @kimmobrunfeldt or myself?

Mine was directed to progressbar.js so it's @kimmobrunfeldt

the-turk avatar Jul 26 '20 16:07 the-turk

As a temporary workaround, you can set option duration for animate() to almost zero time

cardioprint avatar Oct 24 '20 15:10 cardioprint