Bug #91086
openPageRenderer doesn't include resources included by USER_INT objects on cache miss
0%
Description
Hello friends :)
I've came across a strange misconduct after reloading a page without cache (logged in on backend and ctrl+f5) on a page with USER objects and exactly one USER_INT that includes a script using PageRenderer->addJsFooterFile. Also happens with CSS.
The file will not be included as long as the cache misses and there is at least one USER object.
After a normal reload (F5) everything works fine.
I was checking out in the core and it seems that a different PageRenderer is being used by ObjectManager than restored in TypoScriptFrontendController:3767 (v.9.5.14).
That solved my problem
Didn't work:
$this->objectManager->get(PageRenderer::class)->addJsFooterFile
Worked:
$GLOBALS['TSFE']->pageRenderer->addJsFooterFile
I also didn't try to reproduce that on a fresh installation yet.
Updated by Deividas Simas over 4 years ago
I could reproduce this issue on a fresh typo3 9.5.15 installation with following setup:
extension with 2 controllers:
User (with empty action)
Userint (has `$this->objectManager->get(PageRenderer::class)->addJsInlineCode('tester', 'console.log("User INT");');`)
The Action of UserintController uncached (added in nonCachableActions array of ExtensionUtility::configurePlugin)
register 2 plugins and print them both out on same page.
Result:
CTRL+F5 will not print the inline JS code. after F5 it appears on header
Updated by Deividas Simas over 4 years ago
TYPO3 10 doesn't seem to add js files from uncached objects at all. I tried with following in UserintController:
$this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class)->addJsFooterFile('EXT:extension_name/test.js');
Nothing happened while UserController did print the script tag accordingly.
Updated by Deividas Simas over 4 years ago
- Category changed from Caching to Frontend