-
Notifications
You must be signed in to change notification settings - Fork 27
Reset uploader state #21
Comments
In my apps I am navigating to a new page so the component becomes unmounted. It seems like you’d remove the upload component from the page on success and render a download box or something. I’m up for coming up with a better solution though. Maybe a prop called reset that will immediately reset the state on complete? |
In my case I do not want to unmount the component. I have a single input which the user can use to add files to different contexts, |
Would adding a prop that resets the state the moment an upload finishes solve the problem? |
That would solve it, yes! |
Cool, I’ll add this tomorrow
…On Thu, Oct 5, 2017 at 00:56 Kyriakos Z. ***@***.***> wrote:
Thar would solve it, yes!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#21 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAbacPpNeFDwNMBvspxH5_oYObiTMqYVks5spGFhgaJpZM4Pt6eH>
.
|
Try @navjobs/upload@3.0.10 and add |
Nice thanks! |
sure, ill do that instead and make a new release. |
I'm actually not sure of a good way to do this, calling reset will cause a state change inside the render, kind of the reason I wish i didnt have this component be a child as function. Feel free to post some ideal code and I'll see if i can do it that way |
see issue kimmelsg#21
I was thinking something more like koox00@013cb7b this way we can reset in the componentWillReceiveProps(props) {
if (props.complete) {
props.onReset();
}
} what do you think? |
see issue kimmelsg#21
Checking componentWillReceiveProps to do an action is a really bad paradigm, and the way I built this component kind of forces you into bad habits like this. I want to rewrite the uploader so that the state is exposed in your component |
Actually isn't possible to reset the uploader's state ? |
@bionicvapourboy when upload is complete, reload the page for now (push to the upload page in react router or something), I have this on my list to rewrite this component but it's in the back of it sadly :( |
Adding "reset" (bool true) in Uploader props solves the issue. It is not mentioned in readme.md but i found it in your source code. Very useful, maybe an hack like refresh page/remount component would made me move to another component. |
I forgot I did add that a month or so back. "maybe an hack like refresh page/remount component would made me move to another component" sorry, i want to remake this way better than it currently is, but i don't have the time right now. |
Is there a way to reset the uploader state?
More specifically what I mean, is how can I reset progress and complete?
I don't see this implemented. but it would be really helpful IMO.
BTW thank you for this lib :)
The text was updated successfully, but these errors were encountered: