This PR allows developers to update the progress label and hint at any point during their callback by calling the render method on the Progress class. Previously, a re-render only occurred between each step, so updating the label or hint to reflect what was about to happen was not possible.
progress(
label: 'Uploading...',
steps: [
'file1.zip',
'file2.zip',
'file3.zip',
],
callback: function ($step, $progress) {
$progress
->label("Uploading {$step}...")
->hint(rand(5, 10).'MB')
->render();
sleep(5);
// It doesn't make sense to call `render` here because the prompt will already
// re-render to update the progress bar once this callback is completed.
$progress->label("Uploaded {$step}");
},
);
Additional render calls on each iteration can add up to a meaningful delay over a lot of iterations, so I don't think it makes sense to always force a re-render on every call to the label or hint methods.
This PR allows developers to update the
progress
label and hint at any point during their callback by calling therender
method on theProgress
class. Previously, a re-render only occurred between each step, so updating the label or hint to reflect what was about to happen was not possible.Additional render calls on each iteration can add up to a meaningful delay over a lot of iterations, so I don't think it makes sense to always force a re-render on every call to the
label
orhint
methods.Fixes #153