Context
Currently, a sub-reference is distinguished by the MWReferenceNode mainRefKey property. This property is null for a normal reference, but for a sub-reference it holds the "list key" of the main ref. In order to make this linkage less fragile and less dependent on a "synthetic" main ref node, we will replace this property with the listIndex of the main ref's InternalItemNode.
We anticipate that this will eliminate the need for the synthetic main ref. It's also a small step towards deprecating the keyIndexes and listKey mechanisms, while still limiting the scope of the change to only affect sub-references.
Especially watch out for copy-paste use cases, which involve merging and regeneration of parts of the InternalList. Does the InternalItemNode survive these transformations?
Implementation
- Create a mainListIndex key for the main content of subref
- Replace usages of mainRefKey with the new mainListIndex key
- Keep mainRefKey mechanism as fallback and track usages
- Deprecate mainRefKey mechanism