Stacks-Editor icon indicating copy to clipboard operation
Stacks-Editor copied to clipboard

Dragging/dropping or pasting an image in rich text mode results in the image uploader showing the same image twice

Open Justin-MSE opened this issue 2 years ago • 1 comments

Describe the bug Dragging/dropping or pasting an image in rich text mode results in the same image being shown twice (side-by-side) in the image uploader.

To Reproduce Steps to reproduce the behavior:

  1. Switch to rich text mode.
  2. Click inside the editor to activate it (you should see a blue border around the editor).
  3. Drag and drop, or paste, an image into the editor.
  4. You should see that image being shown twice (side-by-side) in the image uploader.

Note that if the editor has not been activated before dragging/dropping an image, only a single image is shown in the image uploader, as intended.

Expected behavior After dragging/dropping or pasting an image in the editor, the image should only be shown once in the image uploader (in rich text mode).

Screenshots

An image being dropped into the editor and resulting in two side by side images

Desktop (please complete the following information):

  • Chrome 104.0.5112.81 on Windows 11

Additional context Also on MSE: Dragging/dropping or pasting an image in rich text mode results in the image uploader showing the same image twice

Justin-MSE avatar Aug 15 '22 05:08 Justin-MSE

Confirmed that I can only repro this in rich-text mode and not markdown mode. That's good info to have as it narrows down the possible culprits quite a bit.

b-kelly avatar Aug 15 '22 13:08 b-kelly

Fixes added in 8785030ec45c37a17d68d11922bc1a0eee858551 and 1353dab70403271928ba005536f00d561b379f58. The bug in question is caused by a race condition. The linked commits will fix this specific instance of that race condition, but does not completely harden the code against further potential instances.

b-kelly avatar Sep 14 '22 18:09 b-kelly