Dynamically updating options in Uppy plugins, uppy.getPlugin(x).setOptions()
See original GitHub issueHi, Everyone
I want the UPLOAD button to show through some kind of boolean flag.
Directly setting up hideUploadButton={true || false}
will work as fine. But, when I try to use it through expression it doesn’t work. The flag used for hideUploadButton
state changes but no changes occur in Dashboard.
hideUploadButton={!contentID}
<Dashboard
uppy={this.uppy}
plugins={[]}
inline={true}
proudlyDisplayPoweredByUppy={false}
showProgressDetails={true}
hideUploadButton={!contentID}
/>
When a User selects an Option from the select box then only the upload button should appear. Else no
- By default
selectedContentID
will be null. If it’s null then the Upload button shouldn’t appear. - When a user selects an option from the select box, the state changes and
selectedContentID
will set, then Upload button will appear.
Even when the props
value gets changed the Dashboard component isn’t re-rendering??
<Dashboard
uppy={this.uppy}
plugins={[]}
height={100}
metaFields={[{ id: 'name', name: 'Name', placeholder: 'file name' }]}
proudlyDisplayPoweredByUppy={false}
showProgressDetails
hideUploadButton={!contentID} // <==== value gets changed but Component doesn't re-render
showLinkToFileUploadResult={false}
note={!contentID ? 'Please select a content topic from dropdown' : ''} // same here
/>
The contentID
might be null
or will have some number.
Even when the contentID
gets changed from null to number, The <Dashboard />
doesn’t re-render?
Working code is available at codesandbox
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Uppy 1.6: setOptions(), Icelandic and Thai
This release adds a long-awaited uppy.setOptions() API, allowing you to update options of Uppy and its plugins on the fly.
Read more >Dashboard - Uppy
@uppy/dashboard is a universal UI plugin for Uppy, offering several useful features: Drag and drop, paste, select from local disk / my device;...
Read more >Writing Plugins - Uppy
The plugin constructor receives the Uppy instance in the first parameter, and any options passed to uppy.use() in the second parameter.
Read more >The Uppy Blog
setOptions() API, allowing you to update options of Uppy and its plugins on the fly. It also includes locales for the Icelandic and...
Read more >const - Uppy
maxNumberOfFiles also affects the number of files a user is able to select via the system file dialog in UI plugins like DragDrop...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It’s not possible right now to change plugin options like
hideUploadButton
after the plugin is installed. We should throw an error in the React components if a prop like that changes.We may implement a
uppy.getPlugin(x).setOptions()
method in the future that can deal with this problem.@jarey sorry for the delay again, I’ve opened a pull requests for some feedback from the team, let’s see how it goes: https://github.com/transloadit/uppy/pull/1728. You are welcome to weigh in there!