node-progress icon indicating copy to clipboard operation
node-progress copied to clipboard

Upgrading to 2.0 causes bar to not display until final tick

Open webOS101 opened this issue 7 years ago • 4 comments

I have an app with a progress bar. Works fine with 1.1.8. When upgrading to 2.0.0, nothing displays until the final tick, which makes a progress bar pretty useless! I added a console.log() statement after the tick method and it does log that our at the appropriate time.

Using node 6.8.0 in a script run with npm.

Bar source:

	const bar = new ProgressBar('Parsing: [:bar] :file (:current/:total)',
								{total: paths.length, width: 20, complete: '#', incomplete: ' '});
// ... (Within loop)
		bar.tick({file: componentDirectory});
		console.log('tick');

Output:

tick
tick
tick
Parsing: [####################] ui/ViewManager (79/79)
tick

webOS101 avatar May 02 '17 19:05 webOS101

I have the same problem, my application has a lot of synchronous processing, so the setTimeout callback is not triggered until the end of processing.

Can we add a feature, if option renderThrottle = 0 is sent to the constructor, then call render() directly instead of using setTimeout?

larshp avatar May 07 '17 08:05 larshp

I added bar.render() after each bar.tick() and it "fixed" this.

Kollibri avatar May 10 '17 15:05 Kollibri

Merged a "fix". I need to test a bit before releasing

thebigredgeek avatar May 10 '17 17:05 thebigredgeek

I'm having this issue, is there an alternative to .render() aftear each tick?

cosmicdust471 avatar Aug 14 '17 20:08 cosmicdust471