Objects with identical hashes only rendering in the tree once

(Issue described in abstract below, sceenshot below that)

I have a tree of objects I want users to be able to path through in the viewer UI. I’m using the “elements” array item field, so my understanding is the viewer should read this as a tree that you expand in the viewer.

As some of this data are simple enums, the objects within this tree resolve into the same hash when serialised.

collection/
├─ element1/
│  ├─ hash1
│  ├─ hash2
├─ element2/
│  ├─ hash1
│  ├─ hash3
├─ element3/
│  ├─ hash1
│  ├─ hash4

When the child objects (element1, etc) are viewed in isolation, I can see both their children. However, when viewed from the commit root, objects with an identical hash are only rendered once:

collection/
├─ element1/
│  ├─ hash1
│  ├─ hash2
├─ element2/
│  ├─ hash3
├─ element3/
│  ├─ hash4

This isn’t ideal as it means that in order to render the tree like my users would expect, with all child elements, I’d need to add some arbitrary data to each object to enforce a unique hash.

Image below:

Hi @chris.welch

Somebody more knowledgeable with the frontend can correct me if I’m wrong, but if the tree display is using the viewer’s tree to read the objects then this behavior is expected as currently the viewer does not allow duplicate id nodes

Cheers

1 Like

Is there a reason for this? My understanding generally with Speckle is that it’s a graph, not a tree - shared references are to be expected.

The speckle viewer’s (the viewer library, not the frontend) scene graph is a tree by design. It’s nodes can contain identical raw speckle objects, but the tree itself cannot contain identical id nodes. Shared references are indeed common, and the viewer allows duplication only via instancing.

Due to requirements, the viewer tree nodes need to have an identity, whereas speckle data in itself does not.