When some content is loaded asynchronous, the required skin extensions are injected separately using the X-XWIKI-HTML-HEAD custom response header. The problem is that the code that does this is defined inside a jQuery code block, meaning that requests that are done before this code is loaded (e.g. from a Prototype code block, which is loaded before) will not have the required skin extensions injected.
Right now, doextra.vm duplicates skin extensions import. For example for the attachments tab, these are done from docextra.vm and also from attachmentsinline.vm, while they should be added only when the attachments tab is actually loaded (i.e. attachmentsinline.vm), to not load resources that may not be needed.
After deleting the imports from doextra.vm, we cannot see the attachments after refreshing the page while being on the attachments tab