-
Notifications
You must be signed in to change notification settings - Fork 153
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
Component is not updating dropzone (djsConfig) options base on parent props #154
Comments
Same error here. Still no updates in the latest version? |
It seems the code has changed, but I still have the problem |
Could this be because in componentWillUpdate it is taking djsConfig from this.props (old props) instead of nextProps (new props)? |
Probably. Can you verify that @wrabbit23? |
I think i have verified it. My issue was a little different. Before i upload a file, i need to refresh an auth token and add it to the headers. I was updating djsConfig but the request always had the old auth token! So I tried updating it twice in the accept function, that way componentWillUpdate gets called twice, and the second time the new headers are the old headers so it gets set. ...and it works. Here's some docs for componentWillUpdate. |
@wrabbit23 would be very cool if you can provide a PR which fixes this =) |
Let me see if i can manage to do that |
Let me know if you need any assistance with that. |
I wasn't able to get the test suite to run locally, and i don't have a lot of time, but this worked when I tested in my app. |
Thank you very much for the PR. I'll review it tomorrow, test it locally and check the test status. |
@felixrieseberg I am trying to update djsConfig based on parent props but options are not updating.
Please find my use case.
I want to disabled click of dropzone if uploadLoading is in progress so I have passed clickable:false if loadingUploadButton is true.
I have debugged into the code and I found that https://github.com/felixrieseberg/React-Dropzone-Component/blob/master/src/react-dropzone.js#L107 you are not updating newProps i.e this.props. djsConfig has the old value you need to replace with newProps.
see this Answers: https://stackoverflow.com/a/32414771, https://stackoverflow.com/a/35919008
Parent Component.
Chilled Component.
Based on loadingUploadButton props changing the djsConfig:
The text was updated successfully, but these errors were encountered: