Context
We want to T415760: [Epic] Implement a new mechanism that connects MWReferenceNodes with InternalItemNodes. To do that we decided on using the listIndex as a connector between refs and their internal items. We started introducing that for the mainRefKey in T415884: [Refactor] Replace MWReferenceNode.mainRefKey with an index to the main ref InternalItemNode. The mainListIndex could now be used in the code to get the internal items for the main ref's content when working with sub-refs.
Task
We want to use a helper method that can be used to get an InternalItemNode with either listKey and listGroup or listIndex this way we can monitor if the new mechanism works in all cases or if a fallback is needed in some.
Introduce a helper method that retrieves the InternalItemNode either using the listKey and listGroup or an optional listIndex
- The method should try to use listIndex first but fallback on listKey and listGroup if that fails
- Add some logging if the fallback is executed although listIndex was defined
Use that method and the mainListIndex to load the content for a main ref in
- MWReferenceContextItem
Notes
- I think we're currently using getInternalModelNode to get the InternalItem. Maybe we alter that method instead of writing something new.
- MWReferenceSearchWidget and MWReferencesListNode are out of scope we need to rebuild the methods generating the lists there to work with listIndex first see T416577: [Refactor] Rebuild methods in ve.dm.MWGroupReferences to work with `listIndex` instead of `listKey`