commercetools / commercetools/nodejs

[sync-actions] State setTransitions update do not work correctly

Open
#1,765 1 comment 0 reactions 0 assignees View on GitHub
Type: Bug
Dominant language
JavaScript
Stars
77
Forks
70
PR merge metrics
No merged PRs in 30d

Description

### Description

When I have 2 arrays of transition in State resource:
```
[
{
"typeId": "state",
"key": "Active"
},
{
"typeId": "state",
"key": "ReminderSent"
},
{
"typeId": "state",
"key": "Cancelled"
},
{
"typeId": "state",
"key": "Paused"
},
{
"typeId": "state",
"key": "Error"
}
]
```
```
[
{
"typeId": "state",
"key": "Cancelled"
},
{
"typeId": "state",
"key": "Paused"
},
{
"typeId": "state",
"key": "Error"
},
{
"typeId": "state",
"key": "Active"
},
{
"typeId": "state",
"key": "ReminderSent"
}
]
```
This would generate an update action:
```
[
{
"action": "setTransitions",
"transitions": [
{
"typeId": "state",
"key": "Active"
},
{
"typeId": "state",
"key": "ReminderSent"
},
{
"typeId": "state",
"key": "Cancelled"
},
{
"typeId": "state",
"key": "Paused"
},
{
"typeId": "state",
"key": "Error"
}
]
}
]
```

However, this update action would fail with this error: `"statusCode":400,"status":400,"message":"'transitions' has no changes."`.

In this case, sync-actions should not generate any update actions, even if the elements in the transition array changed their positions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.