Project

General

Profile

Actions

Bug #91086

open

PageRenderer doesn't include resources included by USER_INT objects on cache miss

Added by Deividas Simas about 4 years ago. Updated about 4 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2020-04-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
pagerenderer, INTincScript, addJsFooterFile
Complexity:
Is Regression:
Sprint Focus:

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.

Actions #1

Updated by Deividas Simas about 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

Actions #2

Updated by Deividas Simas about 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.

Actions #3

Updated by Deividas Simas about 4 years ago

  • Category changed from Caching to Frontend
Actions

Also available in: Atom PDF