mironov / react-redux-loading-bar

Loading Bar (aka Progress Bar) for Redux and React
https://mironov.github.io/react-redux-loading-bar/
MIT License
936 stars 93 forks source link

`resetLoading()` method is not fully resetting the component. #96

Closed jonrandahl closed 5 years ago

jonrandahl commented 5 years ago

Describe the bug We first call the showLoading() method in our primary HOC to initiate the component and display the progress animation while data is arriving; we were then closing all of these calls via the hideLoading() method in the individual components which display the data and this was working perfectly.

We then added another component to the HOC which enabled the users to change the parameters of the data requested and therefore included the hide and show calls to that component in order to both clear and initiate new calls to the progress animation.

We then noticed if a user changed their mind while the data was arriving and updated the parameters thereby requesting a "new" dataset, even with the hide and show calls in the selector component, the progress animation was never actually restarted and the loading bar would appear partially completed based on where the original request's animation had reached?

We then investigated your documentation and repo further and found the resetLoading() method and replaced all hideLoading() calls as such. While this seems to have definitely forced the loading bar to hide as described by the original ticket, this has not resolved the issue where the progress animation is not actually reset completely?

Expected behaviour resetLoading() and/or hideLoading() methods to return the animation to the initial state and force the progress animation to start from the beginning again.

Version Information:

Additional context ICYW, we are not using the middleware because of the multiple manual triggers in our app.

mironov commented 5 years ago

@jonrandahl First of all, thank you for the perfect bug report with a detailed explanation of the problem.

I've released v4.5.0 that improves the handling of the situation when the progress is reset (start is called right after stop). I'm not 100% positive that it fixes your particular problem though. In my testing, the Loading Bar resets the progress as expected when showLoading() is called right after resetLoading().

Could you give v4.5.0 a try, please?

jonrandahl commented 5 years ago

Thanks @mironov, was just reassigned the issue on our platform so I will implement the new version and report back if this has resolved or improved anything.

J

jonrandahl commented 5 years ago

I've now tested the updates in v4.5.0 as requested and while I can confirm the issue initially reported has been resolved I'm not 100% sure, as you stated, whether it was us moving the dispatch calls around in our child components or the update itself. Nonetheless, I'm closing this ticket as the original issue has been resolved. Thank you for all your hard work with this module!