Can not preserve expansion state

The extension that I’m working on uses sidebars. Since those are reloaded regularly, I tried to set the TreeItems’ identifiers to unique strings, which are shared by previous and replacement items that are analogous and whose expansion state I want to preserve. Unfortunately, even though I’m confident of that the identifiers are unique and shared by corresponding old and new TreeItems, expansion state is invariably reset upon reload.

How could I debug this? Thanks :slightly_smiling_face:.