The registration of a node requires an ID to be given.
This ID is then used internally in LRUD for retrieving/manipulating the specific Node.
IDs are also "surfaced" and used as part of the API, in functions such as getNode(<node id>)
.
Questions have been raised around whether or not LRUD should support duplicate IDs.
Is it technically feasible?
Yes. The actual "internal" ID of a node could be the combination of its own ID and all its parents. This means we could handle duplicate IDs as long as no 2 IDs were both duplicates and siblings.
OR, we could make it so all IDs that are registered are actually registered as the ID concatonated with a UUID, etc.
So the question is, should we?
Pros
nav.registerNode('footer', { parent: 'left_column' })
nav.registerNode('footer', { parent: 'right_column' })
Cons
getNode(<node id>)
. If duplicate IDs exist in the tree, these methods must handle this.getNode()
(as explained above). This means service land will now need to start keeping track of which nodes live under which parents, etc. which immediately becomes a huge headache.We have decided that until the need arrises, we will not allow duplicate IDs.
If registerNode()
is called with an ID that has already been registered against the navigation instance, an exception will be thrown.
Approved
As discussed above, it means the registration data and processes of registering must ensure that no duplicate IDs are used.