Stacks-Editor
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
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:
- Switch to rich text mode.
- Click inside the editor to activate it (you should see a blue border around the editor).
- Drag and drop, or paste, an image into the editor.
- 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
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
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.
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.