fix(schema-org): dedupe typed arrays by @type during node merge#702
Conversation
When two components define Product with different offers.availability values, the merge function was concatenating the offers arrays instead of letting the later definition win. Now arrays of typed schema.org objects are deduped by @type, matching the existing potentialAction behavior. Closes harlan-zw/nuxt-schema-org#94
Bundle Size Analysis
|
π WalkthroughWalkthroughThis change fixes a merging conflict in schema.org object handling by implementing deduplication logic for arrays of typed objects. When merging multiple schema.org objects with the same Changes
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Poem
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 warning)
β Passed checks (4 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 |
π Linked issue
Resolves harlan-zw/nuxt-schema-org#94
β Type of change
π Description
When two schema-org entries share the same
@id(e.g. twoProductnodes from different components), themerge()function deep-merged their nested objects. For arrays of typed schema objects likeoffers, this caused conflicting scalar values (e.g.availability: InStockvsOutOfStock) to both be retained instead of the later definition winning.Extends the existing
@typededuplication logic (previously only applied topotentialAction) to all arrays of typed schema objects. When merging arrays where every element has a@typeproperty, later definitions now override earlier ones by type.