fix(vtex): filter undefined products from sortProducts - #1611
Conversation
When requesting products by SKU IDs, if a SKU doesn't exist or is inactive in VTEX, the API simply omits it from the response. The sortProducts function was mapping over the original ID list, resulting in undefined entries for missing SKUs. Added filter(Boolean) to remove those entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Tagging OptionsShould a new tag be published when this PR is merged?
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughIn ChangessortProducts undefined filtering
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
intelligentSearch/productList.ts, if a SKU doesn't exist or is inactive, the VTEX API omits it from the responsesortProductsfunction maps over the original ID list, which resulted inundefinedentries for missing SKUs.filter(Boolean)to removeundefinedentries from the returned arrayTest plan
undefinedentries🤖 Generated with Claude Code
Summary by cubic
Fixes VTEX product sorting when requesting by SKU IDs by removing undefined entries for missing/inactive SKUs, preserving the order of valid products. Implemented by adding .filter(Boolean) to
sortProductsinvtex/utils/transform.ts.Written for commit 10efdbd. Summary will update on new commits.
Summary by CodeRabbit
Release Notes