commercetools / commercetools/nodejs
[sync-actions] Compare only id and typeId fields when syncing references
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 77
- Fork
- 70
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.",
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia individuando la logica di sync-actions che confronta SET di attributi REFERENCE e trova i test esistenti. Riproduci le due strutture prima/dopo descritte nell’issue, quindi verifica che i riferimenti invariati non producano un’azione di aggiornamento, mentre i valori id o typeId modificati continuino a produrla.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 48/100