Skip to content

feat(migrate): dedupe exact-duplicate VTEX blocks - #215

Merged
JonasJesus42 merged 1 commit into
mainfrom
migrate-vtex-block-dedup
Aug 17, 2026
Merged

feat(migrate): dedupe exact-duplicate VTEX blocks#215
JonasJesus42 merged 1 commit into
mainfrom
migrate-vtex-block-dedup

Conversation

@JonasJesus42

@JonasJesus42 JonasJesus42 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

You flagged that 5242 blocks is a lot / could have repeats — correct.

Merging block trees across pages ballooned blocks.json because structurally-identical instances (a product-summary per product, repeated layout wrappers like hide-and-show) each have a distinct treePath, so the treePath-merge didn't collapse them.

Fix: dedupeVtexBlocks collapses exact duplicates (same blockName + identical props) into one representative with a repeated count. Blocks with distinct content (banners with different images, etc.) are kept. The FastStore mapper counts via repeated, so instance totals stay accurate.

Verification

Unit tests (collapse identical, keep distinct). Full suite green (1109), tsc + biome clean, build OK. Live electrolux.com.ec: 5242 → 883 blocks (581 groups collapsed; hide-and-show ×458), same content coverage.

Off main.

🤖 Generated with Claude Code


Summary by cubic

Collapses exact-duplicate VTEX blocks during migration to shrink blocks.json without losing coverage. Previously each instance (unique treePath) was counted separately; now identical blockName with identical props merge into one block with a repeated count. Distinct-content blocks are unchanged, and FastStore mappings still reflect accurate totals via repeated.

Review notes

  • Apply dedupeVtexBlocks to the collected vtexBlocks in migrate.ts.
  • Update mapVtexBlocksToFastStore to count using b.repeated when present.
  • Add tests covering collapse of identical blocks and preservation of blocks with different props.
  • Verified on electrolux.com.ec: 5242 → 883 blocks, same content coverage.

Written for commit 1964d41. Summary will update on new commits.

Review in cubic

…r product, wrappers)

Merging block trees across pages ballooned blocks.json (509 → 5242 on Electrolux)
because structurally-identical block instances (a product-summary per product,
repeated layout wrappers like hide-and-show) each have a distinct treePath and so
weren't deduped. `dedupeVtexBlocks` now collapses EXACT duplicates (same
blockName + identical props) into one representative with a `repeated` count —
blocks with distinct content (e.g. banners with different images) are kept. The
FastStore mapper counts via `repeated` so instance totals stay accurate.

Live electrolux.com.ec: 5242 → 883 blocks (581 groups collapsed; hide-and-show
×458 etc.), same content coverage. Full suite green (1109), tsc + biome clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@JonasJesus42
JonasJesus42 merged commit 46fc3b8 into main Aug 17, 2026
1 check passed
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.

1 participant