Since we deployed Vector 2022 to English Wikipedia it seems our gadget support is not as a good as might be expected. See T327369 for example.
A mw.hook is expected to be run once but in the case of addPortletLink is run multiple times. This means users must run additional code to handle race conditions where hook handlers are registered late.
It's currently used in Minerva and Vector to add icons to certain menu items.
Possible alternatives are
- using mw.trackSubscribe
- removing it and upstreaming Vector/Minerva behavior to core. Both Minerva and Vector use this hook to add an icon element. Options could be added to the existing skin flag to handle this case. This would require some cleanup in Minerva to drop the Minerva specific classes.