Skip to content

fix(id-web): insert pasted/dropped image batches in file order (#1323) - #3194

Merged
dezren39 merged 1 commit into
mainfrom
queue/1312-1323-paste-order
Oct 31, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/1312-1323-paste-order

Conversation

@dezren39

@dezren39 dezren39 commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Fixes #1323.

Problem

Multi-image paste/drop inserted images in upload-completion order, not clipboard order: handlePaste/handleDrop started every upload from the same insert position and each upload inserted its image independently when its fetch resolved. Verified by probe in #1323 and by the new regression tests (both fail on the old implementation, pass on this one).

Fix — ordered insertion chain (uploads stay concurrent)

  • startImageUploadBatch starts every upload immediately and adds placeholders in file order, but chains the insertion steps: each file's step awaits the previous batch member's step before touching the document.
  • A failed upload resolves its step without inserting, so survivors keep their relative order and only the failed placeholder is removed.
  • Single-image paste/drop is the degenerate one-member batch — behavior unchanged.

Tests

  • New handlePaste batch ordering (#1323) block in image-upload.test.ts (real EditorView + plugin, deferred fetch mocks):
    • batch resolved out of order → document order equals clipboard order (and nothing inserts early, before the first slot resolves);
    • mid-batch failure → only its placeholder is removed, survivors keep order.
  • Fail-first verified: both new tests fail against the pre-fix implementation (stash the .ts, keep the tests).
  • bunx vitest run src/image-upload.test.ts — 45/45 pass (laptop).
  • Full web suite: 492 passed, 1 failed, 9 skipped — the one failure is search-panel.test.ts role=search/aria-label, which fails identically on clean main (zero diff in those files on this branch); pre-existing, unrelated.

Queue task 1312 (triage packet directed implementation with the regression test).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner October 31, 2026 19:29
@coderabbitai

coderabbitai Bot commented Oct 31, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 23 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 559c6646-08f5-431d-bde5-269ea1b599c1
Commits

Reviewing files that changed from the base of the PR and between 236cb98 and 6699f09.

Files selected for processing: 2
  • pkgs/id/web/src/image-upload.test.ts
  • pkgs/id/web/src/image-upload.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T19:31:12.872235Z 6699f09 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

id(web): multi-image paste/drop inserts images in upload-completion order, not clipboard order

1 participant