I noticed that recently the tree component was modified to remember the expanded state of every node on each post back. This works great but I found an unexpected behaviour and I wanted to know if it's a bug or that's the way it should work.
Let's assume the following structure:
| +-- A1
| +-- A2
At first, all the nodes are collapsed. Now, the user opens node B to reveal node B1 and B2. He does something that generates a post back. During that post back, a node is inserted in the middle of the tree. The structure now looks like this:
One could expect that when the tree is re-rendered, the nodes A and C would be collapsed and node B would still be expanded. But, that isn't the case. After the re-render, it's now the C node that is expanded and the B node is collapsed. I've done other tests and it seems that the expanded state is remembered based on the position in the tree, not based on the "identity" of the node. Is this a bug or is this the expected behaviour? If it is the expected behaviour, is it because remembering the expanded state based on the "identity" of the node is impossible?