addLinkData not working in GoJs Grouping

Hi GoJs,
I am trying to achieve GoJS-Icons inside GoJS-Grouping.
But while mapping “subGraphExpandedChanged”, I am facing the bug as in screenshot.
Also, drag & drop from to , its not inserting in GoJs-Grouping expanded section.

output:

Is there a way to build layout as per my expectation? Maybe there are more concrete examples or solutions for that? Please share.

First, why are you counting the number of groups?

Second, do you really want to add two nodes and a link each time a group is expanded or is collapsed?

Third, is the value of Model.nodeKeyProperty set to “id”?
That property’s default value is “key”, so unless you changed that property to “id” when you constructed the model, you need to set each node data object’s “key” property so that you can refer to them from a link data object.