Skip to content

Update shein schema import performance#578

Merged
BranDavidSebastian merged 2 commits intomasterfrom
development
Mar 10, 2026
Merged

Update shein schema import performance#578
BranDavidSebastian merged 2 commits intomasterfrom
development

Conversation

@BranDavidSebastian
Copy link
Copy Markdown
Collaborator

@BranDavidSebastian BranDavidSebastian commented Mar 10, 2026

Summary by Sourcery

Improve image handling in bulk variation editing and optimize Shein category and remote document type handling.

New Features:

  • Deduplicate variation images before saving to ensure consistent sort order and main image selection.
  • Expose Shein category full path from the API and surface it in the UI for category selection and display.

Bug Fixes:

  • Prevent duplicate variation image records from being created or inconsistently updated during bulk save operations.

Enhancements:

  • Simplify Shein category path resolution by using server-provided fullPath instead of client-side parent traversal.
  • Adjust remote document types listing to use a single effective name field instead of separate name and translatedName columns.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 10, 2026

Reviewer's Guide

Improves product variation image saving by deduplicating images before persistence and optimizes Shein category import/display by using server-provided full paths and an effectiveName field, reducing client-side graph traversal and aligning queries/configs with new API fields.

Sequence diagram for Shein category decoding using server fullPath

sequenceDiagram
  actor User
  participant SheinCategoriesList as SheinDocumentTypeCategoriesList
  participant GraphQLAPI as GraphQL_API
  participant NodeCache as nodeCache
  participant PathMap as pathMap

  User->>SheinCategoriesList: Open_document_type_category_mapping
  SheinCategoriesList->>SheinCategoriesList: decodeCategories()
  SheinCategoriesList->>GraphQLAPI: sheinCategoriesQuery(remoteIds)
  GraphQLAPI-->>SheinCategoriesList: nodes(remoteId,name,fullPath,parentRemoteId,...)

  loop For_each_received_node
    SheinCategoriesList->>NodeCache: store_normalized_node(remoteId)
    SheinCategoriesList->>PathMap: pathMap[remoteId] = fullPath || name || remoteId
  end

  SheinCategoriesList-->>User: Render_categories_with_paths

  User->>SheinCategoriesList: Manually_select_category(remoteId)
  SheinCategoriesList->>NodeCache: get_node(remoteId)
  SheinCategoriesList->>SheinCategoriesList: path = node.fullPath || node.name || node.remoteId
  SheinCategoriesList-->>User: Show_selected_category_path(path)
Loading

Class diagram for variation image deduplication and Shein category selection node

classDiagram
  class VariationImageSlot {
    string id
    string mediaId
    bool isMainImage
  }

  class VariationRow {
    string id
    VariationImageSlot[] images
  }

  class VariationImagesBulkEditService {
    +getDedupedImagesForSave(row)
  }

  class DedupedImage {
    VariationImageSlot slot
    int sortOrder
    bool isMainImage
  }

  VariationRow "1" --> "many" VariationImageSlot : has
  VariationImagesBulkEditService --> VariationRow : reads
  VariationImagesBulkEditService --> DedupedImage : returns

  class SheinCategoryNode {
  }

  class SheinCategorySelectionNode {
    string remoteId
    string name
    string fullPath
    string parentRemoteId
  }

  SheinCategorySelectionNode ..|> SheinCategoryNode
Loading

File-Level Changes

Change Details Files
Deduplicate variation images before save so sort order and main image flags are computed on a per-media basis.
  • Introduce getDedupedImagesForSave to collapse duplicate mediaId entries per variation row while preserving the lowest sort index, merged isMainImage flag, and preferring slots with an id.
  • Replace direct iteration over row.images in the save() function with iteration over the deduplicated image list, propagating sortOrder and isMainImage from the deduped structure.
  • Adjust creation and update payloads to use the deduped sortOrder and isMainImage values and to diff against the original images using these normalized values.
src/core/products/products/product-show/containers/tabs/variations/containers/variations-images-bulk-edit/VariationsImagesBulkEdit.vue
Leverage Shein category fullPath from the API instead of building it client-side, simplifying and speeding up path resolution.
  • Extend SheinCategorySelectionNode with an optional fullPath property and populate it in normalizeSheinNode from the raw node.
  • Store decoded category paths directly from node.fullPath (falling back to name or remoteId) instead of asynchronously traversing parents, and remove the buildPathFromNode helper and its usage.
  • Update path formatting and manual category selection to prefer node.fullPath, with fallbacks to name or remoteId.
src/core/integrations/integrations/integrations-show/containers/document-types/containers/remote-document-types/components/categories-lists/SheinDocumentTypeCategoriesList.vue
Align remote document types listing and queries with new effectiveName field from the backend.
  • Update remoteDocumentTypes listing config to show effectiveName instead of separate name and translatedName columns and fields.
  • Adjust remoteDocumentTypes GraphQL query to request effectiveName instead of name and translatedName.
  • Extend Shein categories GraphQL query to include fullPath so the UI can use server-computed paths.
src/core/integrations/integrations/integrations-show/containers/document-types/containers/remote-document-types/configs.ts
src/shared/api/queries/salesChannels.js
src/shared/api/queries/sheinCategories.js

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@BranDavidSebastian BranDavidSebastian merged commit 68e7801 into master Mar 10, 2026
1 check passed
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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