-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch progress completion incorrect when using mock sender #626
Comments
hey @mwdiaz P.S. When I wrote the mock-sender I mostly thought about Uploady internal tests and faster dev time for the library. Its really cool to see that others use it as well and it makes a lot of sense, of course. |
Thanks! Yeah, the mock sender has been great for us; both in interactive Storybook examples as well as unit tests. |
It's been a while. Waiting for an update... 🧐 |
hey @mwdiaz, Uploady 1.7.0-rc.0 is available now with a fix for the issue 🤞. Note that if the config value is provided, it will be used so if you've added it to the initialization of the mock-sender, you should remove it. Let me know if it works for you. |
Thanks! I'm out of the office on vacation, but will definitely check it out when I'm back next week. |
Just tried it out and things look better! One thing I've noticed is that for batch progress events the Thanks for the quick fix, when do you think a non-RC version might be made available on npm? |
Hope you had a nice vacation Mike. |
actually, the inconsistency isnt related to the mock-sender specifically. |
release 1.7.0 is now available |
Describe the bug
As of v1.5.0 (I believe due to the change made in #566), the
completed
property for a given Batch when usinguseBatchProgressListener
reports the incorrect percentage if also using a mock sender.I think this is due to using the underlying file's size here when determining the total size of the batch. When using a mock sender, the file size is determined by the
fileSize
option passed togetMockSenderEnhancer
, but there is still a real underlying File object that will report the correct size and not the mocked size.It might be nice if the progress timers for each mocked request did use the actual file size instead of a hard-coded value in the mock sender, since that might add a dash of realism to interactive examples in Storybook, but I understand if that isn't feasible for technical reasons. Regardless, having the batch progress work accurately in this scenario (as was the case prior to v1.5.0) is useful for us since where we display an overall progress bar along with individual item progress bars and use a mock sender in our design system (Storybook / Chromatic).
To Reproduce
Steps to reproduce the behavior:
mockSender
)<Uploader>
, utilize theuseBatchProgressListener
hook and observe that thecompleted
property for the batch is incorrect, given the progress intervals for the file being "sent"Expected behavior
Batch progress should accurately reflect mocked items progress intervals when using
mock-sender
.Versions
v1.5.0+
Code
Here's a simple CodeSandbox demonstrating the issue: https://codesandbox.io/s/muddy-dream-7jy765. If the
@rpldy/*
dependencies are reverted to 1.4.1. or earlier, the behavior will be as expected.The text was updated successfully, but these errors were encountered: