Problem/Motivation
It is easy for editors to accidentally create duplicate media entities using the Bynder compact UI. The "Add asset" button is slow to respond and does not disable itself when the user clicks, so editors can be confused into thinking they need to click it again, while things are working in the background. This results in multiple Bynder entities being created for the same asset.
GIF screencast showing issue

Steps to reproduce
Select an asset with the Compact UI, click the "Add asset" button, confirm the button shows an ajax load, but then goes back to "Add asset" and is clickable again before the browser submits.
Proposed resolution
Disable the "Add asset" button until the form is complete.
Remaining tasks
User interface changes
API changes
None expected
Data model changes
None expected
| Comment | File | Size | Author |
|---|---|---|---|
| byner-compact-multiple-create-bug.gif | 786.87 KB | dave reid |
Issue fork bynder-3259398
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dave reidThis may be a bug report to file with the Compact UI itself, but I think the slowdown is the Drupal AJAX request, because I don't see the button revert back to "Add asset" when using the native non-Drupal version.
Comment #3
dave reidComment #4
berdirDiscussed internally, it might be the form submission that is not async? we could try to put that inside a setTimeout() to see if that helps.
Comment #5
dave reidWe keep running into this with editors, it's incredibly easy to accidentally click that button twice while it's working the first time but not showing anything.
Comment #6
richardbporter commentedThis is even more problematic when DAT is enabled. @berdir could you expand on the async/setTimeout idea or any others you might have?
Comment #10
primsi commentedDiscussed with @berdir to try with hiding the compact view entirely and replace it with `Uploading assets...`
Comment #11
primsi commentedThe first file attached, showing the status, didn't seem to work. Trying with a link to google drive.
https://drive.google.com/file/d/1qu32wkGvGjEZII71vRsP7K5zekIrRgaD/view?u...
Comment #12
primsi commentedAdditional note: I use throttling so it's more obvious. That's why it's so slow.
Comment #13
adam-delaney commented@primsi, I've tested you changes and this works for me. Do we know if we can get a stable release for this module with this included?
Comment #15
berdirThanks for testing and confirming. Merged, a release will follow soon.