Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[sync-actions] Compare only id and typeId fields when syncing references

オープン
#1,253 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
api

調査の方向性

まず、REFERENCE 属性の SET を比較する sync-actions ロジックを見つけ、その既存のテストを確認します。Issue に記載されている 2 つの変更前/変更後の形状を再現し、変更されていない参照では更新アクションが生成されない一方で、変更された id または typeId の値では引き続き生成されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Type: Bug

When syncing attributes with SET of REFERENCE type it should compare only fields id and typeId. For example:

If the attribute before and after looks like this:

{
	name: 'setOfReference',
	value: [{
		id: '517321b8-7e3f-4427-ac5e-9d9001d69dc4',
		typeId: 'product'
	}, {
		id: 'f49aceda-145b-4975-af1b-a8c782b54354',
		typeId: 'product'
	}]
}

It won't generate any update actions, which is correct.

But if the before looks like this:

{
	name: 'setOfReference',
	value: [{
		id: '517321b8-7e3f-4427-ac5e-9d9001d69dc4',
		typeId: 'product',
		obj: { /** resolved product */ }
	}, {
		id: 'f49aceda-145b-4975-af1b-a8c782b54354',
		typeId: 'product',
		obj: { /** resolved product */ }
	}]
}

It will generate update action:

{
	"action": {
		"action": "setAttribute",
		"variantId": 1,
		"name": "packageContents",
		"value": [{
			"typeId": "product",
			"id": "517321b8-7e3f-4427-ac5e-9d9001d69dc4"
		}, {
			"typeId": "product",
			"id": "f49aceda-145b-4975-af1b-a8c782b54354"
		}],
		"staged": true
	}
}

Which is wrong because SET items were not changed so the API will throw an error:

"message": "A duplicate combination of the variant values (sku, key, images, prices, attributes) exists.",
主要言語
JavaScript
スター
77
フォーク
70
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

commercetools/nodejs のほかの issue

commercetools/nodejs の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。