Make picture invisible

i m working on a diagram with tree mapper as base i have made a custom tree expander button with click on go.picture


now the problem in first group is that the last node is not considered leaf cz it has links to other group and i binded picture .visible to istreeleaf of node
is there a way to make it invisible

Make sure that all of those blue Links have Link.isTreeLink set to false. If you are using a separate template for those links, it’s easy to just set it in that template.
https://gojs.net/latest/api/symbols/Link.html#isTreeLink