fix: assign facets to channel when re-importing products via CSV#4713
fix: assign facets to channel when re-importing products via CSV#4713Ryrahul wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a bug where facets and variantFacets were not being imported when re-importing products into newly created channels. The importer now clears internal caches (facetMap, facetValueMap, and taxCategoryMatches) at the start of each import run to prevent stale entity references. Additionally, when an existing Facet or FacetValue is discovered during import, it is now explicitly assigned to the current channel via Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Fixes #4673
Description
When importing products via CSV into a newly created channel (after the same CSV was already imported into the default channel), facets and variantFacets were missing from the imported products.
Root cause: The
Importeris a singleton, so itsfacetMapandfacetValueMapcaches persisted across import calls. On the second import, cached facet entities were reused without being assigned to the new channel. Additionally, whenfindByCode()found an existing facet (global lookup, no channel filter), the importer reused it without callingassignToChannels()— so the facet/facet-value entities were never associated with the new channel. The product resolver'sfindByIdsInChannel()then filtered them out, returning empty arrays.Fix:
facetMap,facetValueMap, andtaxCategoryMatchescaches at the start of eachimportProducts()callchannelService.assignToChannels()for existing facets and facet values found viafindByCode(), ensuring they are assigned to the current import channelBreaking changes
None.
Checklist
📌 Always:
👍 Most of the time:
Need help on this PR? Tag
@codesmithwith what you need.