Closed
Description
Preconditions
- Magento 2.1.2
- PHP 7
- MySQL 5.6
- Nginx
Steps to reproduce
- Set
$this->_isScopePrivate = true;
in your block constructor (afterparent::__construct()
) - Load a page with the block displayed and FPC enabled
- Change the contents of your block
- Reload page
Expected result
- New block content displayed as content is AJAX'd in via
/page_cache/block/render/
Actual result
- Cached content is still shown, unless you clear browser cache manually.
I was using this in my own project to show/hide a pop-up based on whether a cookie was present or not. Setting your block scope to private means that Magento will AJAX in the block content after the initial page load and replace some placeholder content with the actual content. While it does do this, it doesn't work fully because of the following line:
https://github.com/magento/magento2/blob/develop/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js#L228
This is causing the browser to cache the response from the AJXA, thus nullifying the point of the private scope.