web: uses queues uid to preserve state on change

When change position changes, the expand state is shifted to the next change.
This patch removes index based key and uses unique references to fix the
issue.

Change-Id: I6f05a1bc34aed6dcb7cc346dd460bf06ad56e019
This commit is contained in:
Tristan Cacqueray 2018-11-02 02:57:16 +00:00
parent 9c2b0a9bbe
commit 75515bcf17
1 changed files with 4 additions and 2 deletions

View File

@ -40,6 +40,8 @@ class Pipeline extends React.Component {
change._tree_position = changeIndex
})
})
// Generate a unique identifier for each queues
changeQueue.uuid = Object.keys(changes).join('-')
changeQueue.heads.forEach(head => {
head.forEach(change => {
if (change.live === true) {
@ -127,12 +129,12 @@ class Pipeline extends React.Component {
filter.indexOf(pipeline.name) !== -1 ||
this.filterQueue(item, filter)
)))
.map((changeQueue, idx) => (
.map(changeQueue => (
<ChangeQueue
queue={changeQueue}
expanded={expanded}
pipeline={pipeline.name}
key={idx}
key={changeQueue.uuid}
/>
))}
</div>