Skip to content

fix(@sanity/cross-dataset-duplicator): address review feedback from #974#1292

Draft
stipsan wants to merge 4 commits into
mainfrom
cursor/fix-cross-dataset-duplicator-review-48b1
Draft

fix(@sanity/cross-dataset-duplicator): address review feedback from #974#1292
stipsan wants to merge 4 commits into
mainfrom
cursor/fix-cross-dataset-duplicator-review-48b1

Conversation

@stipsan

@stipsan stipsan commented Jun 18, 2026

Copy link
Copy Markdown
Member

Addresses the Copilot review feedback on the merged migration PR #974 for @sanity/cross-dataset-duplicator. All 10 review comments are resolved.

Walkthrough

Demo of the duplicator UI after the fixes — corrected EXISTS tooltip copy, singular/plural button label, and a zero-asset duplication completing cleanly (no broken progress bar):

cross_dataset_duplicator_review_fixes_demo.mp4

EXISTS tooltip now reads "…with the same ID and Updated time." and statuses render via the index map:

EXISTS tooltip and statuses

Button label correctly uses the singular "1 Document" (previously this branch was unreachable):

Singular button label

Changes

src/components/Duplicator.tsx

  • Index destination docs by _id so status updates are O(n) instead of O(n²).
  • Fail fast when an asset download response is not ok (e.g. 401/403/404) instead of uploading the error body as the asset, and surface the message.
  • Create a single merged asset document at the uploaded _id, avoiding an orphaned asset document when an SVG's _id changes on upload.
  • Clone documents before remapping SVG references so objects held in React state (payload) are never mutated in place.
  • Fix the duplicate button label: show counts for single-item selections and only insert "and" when both documents and assets are selected.
  • Guard the progress bar against a zero-asset payload (no more NaN/Infinity transform).

src/components/StatusBadge.tsx

  • Tighten the awkward EXISTS tooltip copy ("with the same ID with the same…" → "with the same ID and Updated time.").

README.md

  • Fix the invalid config snippet (export default defineConfig(...)).
  • Remove stale standalone-repo sections (plugin-kit dev workflow, semantic-release) and the duplicate License section.

LICENSE

  • Update the copyright year to the current year.

Testing

  • pnpm format, pnpm lint, pnpm build, pnpm test run all pass.
  • Manually verified in the test studio (pnpm dev): ran the duplicator query, confirmed the corrected tooltip, singular/plural button label, status badges (EXISTS/OVERWRITE) computed via the index map, and a zero-asset duplication completing with no broken progress-bar rendering.
  • Asset/SVG-specific paths (merged asset doc, dset clone, download res.ok) are covered by the type-checked build, lint, and tests.

A patch changeset is included.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

…view

Address review feedback on PR #974 in the Duplicator component:
- Index destination docs by _id so status updates are O(n) not O(n²)
- Fail fast when an asset download response is not ok (e.g. 401/403/404)
  instead of uploading the error body as the asset, and surface the error
- Create a single merged asset document at the uploaded _id (avoids leaving
  an orphaned asset document behind when an SVG's _id changes on upload)
- Clone documents before remapping SVG references so React state objects
  held in `payload` are never mutated in place
- Fix the duplicate button label: show counts for single-item selections
  and only insert "and" when both documents and assets are selected
- Guard the progress bar against a zero-asset payload (avoids NaN transform)
…copy

The EXISTS document tooltip read awkwardly ("with the same ID with the
same Updated time"); tighten it to "with the same ID and Updated time".
…up README/LICENSE

- Correct the invalid config snippet (`export default defineConfig(...)`)
- Remove stale standalone-repo sections (plugin-kit dev workflow and
  semantic-release) and the duplicate License section
- Update the LICENSE copyright year to the current year
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
plugins-studio Ready Ready Preview, Comment Jun 18, 2026 3:47pm

Request Review

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants