transloadit / uppy

The next open source file uploader for web browsers :dog:
https://uppy.io
MIT License
29.07k stars 2k forks source link

thumbnail:generated doesn't fire after adding single file then adding more files #4287

Open bucherc opened 1 year ago

bucherc commented 1 year ago

Initial checklist

Link to runnable example

No response

Steps to reproduce

Steps to reproduce:

1) Add local file to Uppy Dashboard 2) The file preview appears (it is a large thumbnail preview because a single file was selected) 3) The thumbnail:generated was properly fired (here we add a custom button to .uppy-Dashboard-Item-fileInfoAndButtons) 4) Click + Add more 5) Add another local file to Uppy Dashboard 6) Now there are two smaller previews...the thumbnail:generated event was fired for the 2nd image but not the first even though it was regenerated to a smaller image 7) Remove the 2nd image from the dashboard by clicking the X on the 2nd image 8) The 1st image is now a larger preview and the thumbnail:generated event was fired (which brings our button back)

Can you please fire the thumbnail:generated event for the first image at step 6?...this will preserve our added button. It seems that you are regenerating the preview for the 1st image from a large preview to a small preview so I believe that event should be fired. It is fired when going from a small preview to a large preview at step 7.

Expected behavior

thumbnail:generated should be fired when going from a large preview to a small preview (regenerates the preview) - see above steps to reproduce

Actual behavior

thumbnail:generated is not fired and we lose our added button

lakesare commented 2 months ago
  1. Now there are two smaller previews...the thumbnail:generated event was fired for the 2nd image but not the first even though it was regenerated to a smaller image

When we drop a single image, two events fire at the same time - one for the generation of the smaller thumbnail, one for the generation of a larger thumbnail. That's why we don't emit this event when it gets regerated to a smaller image - the result of this operation is already cached.

I do feel our thumbnail generation events could be improved, but would you explain your use case please? What kind of button are you adding?