[ADM] Fix bug: ID auto numbering occurring in reverse.#243
Conversation
|
Why is the problem related to findNodesByProperty? |
|
@zhizhangchen Set a break point at ADMNode.prototype.setProperty() and set the condition to 'property == "id"', then drop a checkbox group into canvas you will see: Update the checkbox group ID is trigger by ModelUpdated event, it catches by projectView's _modelUpdatedHandler(), then it use findNodesByProperty() to traverse the children checkboxes, and use generateUniqueProperty() to generate ID. The problem is generateUniqueProperty() generate correct IDs - checkbox1, checkbox2 and checkbox3, but findNodesByProperty() returns the nodes reversed - node3, node2, node1. So it applied incorrect IDs - node3 applied 'checkbox1', node2 applied 'checkbox2' and node1 applied 'checkbox3'. In fact, I have no idea why here traverse the node reversed, traverse in order maybe work too. BTW: The function only called in project.js so far. $ grep -nr findNodesByProperty * |
|
(Because we didn't address the real problem, this bug could resurface if something changes that gets the ID properties accessed before we get to this function.) |
|
Merged. |
No description provided.