User tests: Successful: Unsuccessful:
Pull Request for Issue #20903 .
This patch fixes a Cache for ScriptOptions, and Language strings (JavaScript).
Need to test Component and Module caching
(I assume you have installed Joomla! with default testing content.)
Edit components/com_content/views/article/tmpl/default.php
, add there:
JFactory::getDocument()->addScriptOptions('foo', array('bar' => 'beer ?'));
JText::script('JGLOBAL_AUTH_ACCESS_GRANTED');
JFactory::getDocument()
->addScriptDeclaration('console.log(Joomla.getOptions("foo", "That a fail!"));console.log(Joomla.JText._("JGLOBAL_AUTH_ACCESS_GRANTED", "That a fail!"));');
Then edit mod_custom /modules/mod_custom/tmpl/default.php
, add there:
JFactory::getDocument()->addScriptOptions('bar', array('foo' => 'panda ?'));
JText::script('JGLOBAL_AUTH_CANCEL');
JFactory::getDocument()
->addScriptDeclaration('console.log(Joomla.getOptions("bar", "That a fail!"));console.log(Joomla.JText._("JGLOBAL_AUTH_CANCEL", "That a fail!"));');
Then enable Caching, and open a page with a Custom module view (in testing data it /custom
url).
Open Browser developer console.
Clear Joomla cache!.
Back to opened page, and do 2 reload of the page (push F5, usually).
1 refresh will display the page without cache
2 refresh will display a cached page
In browser console, after each refresh you should see a messages, like on this screen (order can be diferent):
In browser console you can see these message only after first refresh, after second (and further page reload) you will see message That a fail!
no
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Status | Pending | ⇒ | Information Required |
Status | Information Required | ⇒ | Discussion |
I have tested this item
also fixes this wrong behavior in (content) plugins using addScriptOptions #26975
I have tested this item
also fixes this wrong behavior in (content) plugins using addScriptOptions #26975
Can I fetch this in Patch Tester or not?
Can I fetch this in Patch Tester or not?
Perhaps I have got this wrong, but when I test I get "that a fail" with or without the patch. Initially i do see the array foo, bar, but on second load I do not see it. Can you provide further instructions please?
Perhaps I have got this wrong, but when I test I get "that a fail" with or without the patch. Initially i do see the array foo, bar, but on second load I do not see it. Can you provide further instructions please?
I have tested this item
I have tested this and I see the results as expected.
Status | Discussion | ⇒ | Ready to Commit |
RTC
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-12-05 22:42:21 |
Closed_By | ⇒ | HLeithner |
It took some time but finally it's merged thanks for your work.
Is issue #20546 related?