We need to have a think about how to deal with web assets on the error pages. For example in #28614 we have an issue with an early exception being thrown in onAfterInitialise
). In this case we haven't loaded the registry file in the AdministratorApplication
!
https://github.com/joomla/joomla-cms/pull/28581/files#diff-de2cf03053c95fda1cc845b63abf324dL64
cc @Fedik
Labels |
Added:
?
|
hm, issue I see is that Registry does not load an asset file for active template,
that normally happen at Dispatch:
joomla-cms/libraries/src/Application/SiteApplication.php
Lines 170 to 175 in 96bff98
What I can think, is to load registry file in the error.php explicitly:
$wa->getRegistry()->addRegistryFile('templates/blablatemplate/joomla.asset.json');
That may help to avoid such problem, what do you think?
It does not have performance issue, because file will be parsed only once and flagged as parsed in registry instance.
I also had in mind a helper methods, like:
// For template
$wa->getRegistry()->addTemplateFile('blabla-name', 'site');
// For component
$wa->getRegistry()->addComponentFile('blabla-name');
or, do it in ErrorDocument::render()
, that maybe more nice
joomla-cms/libraries/src/Document/ErrorDocument.php
Lines 100 to 110 in ad0b43e
That may help to avoid such problem, what do you think?
It does not have performance issue, because file will be parsed only once and flagged as parsed in registry instance.
I thought about that but I couldn't actually see any code preventing it from being parsed a second time actually
but I couldn't actually see any code preventing it from being parsed a second time
ups, that actually a bug
it must be here:
joomla-cms/libraries/src/WebAsset/WebAssetRegistry.php
Lines 223 to 229 in ad0b43e
but I see it missed check for if (!empty($this->dataFilesParsed[$path]))
,
I will prepare a pull request, maybe at the weekend
Status | New | ⇒ | Confirmed |
Build | staging | ⇒ | 4.0-dev |
fun thing, the issue was already fixed in past, but because the path was hardcoded for the "site" it does not work for administrator
joomla-cms/libraries/src/Error/Renderer/HtmlRenderer.php
Lines 52 to 55 in 96bff98
I have made pull #28636
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-04-11 09:20:18 |
Closed_By | ⇒ | wilsonge |
ahh oops :) closing for the PR
The error page is a
ErrorDocument
, in the end instance ofDocument
, which should load WebAsset already, every time newErrorDocument
/Document
instance are madejoomla-cms/libraries/src/Document/Document.php
Lines 332 to 341 in 96bff98
This will pull the AssetRegistry from Container, which already load all required assets:
joomla-cms/libraries/src/Service/Provider/WebAssetRegistry.php
Lines 38 to 48 in 96bff98