-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IBX-2597: Removing first Pesonalized block from page builder editor removes both previews #113
IBX-2597: Removing first Pesonalized block from page builder editor removes both previews #113
Conversation
…emoves both previews
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I just have a minor concern, because we're doing things slightly differently than the way it is shown in the example from Symfony.
$this->encoreTagRenderer->reset(); | ||
$this->entrypointLookupCollection->getEntrypointLookup('ezplatform')->reset(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that this is done inside a sub-request of sorts, and for whatever reason the scripts/links are not treated separately by Symfony, you should also reset the internal cache after the response is generated. It is done so in the example provided:
// src/Controller/SomeController.php
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
class SomeController
{
public function index(EntrypointLookupInterface $entrypointLookup)
{
$entrypointLookup->reset();
// render a template
$entrypointLookup->reset(); // <------ Note the second call
// render another template
// ...
}
}
So what I think you want to do is store the response in a variable instead of returning it immediately, and call resets a second time. And only then return the response.
Without it, any scripts/links generated in the template will not be likewise present in the parent response. There is a practice where JS is included at the end of the HTML document, and that addresses it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added second call: a16f380
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
QA Approved on Ibexa Commerce 3.3.33-dev, problem does not occur anymore.
v3.3
This bug occurs because normally
encore_entry_link_tags
is loaded only once per request, but we add{{ encore_entry_link_tags('ezplatform-personalization-css', null, 'ezplatform') }}
in each block tempate. Combination of this results in situation, where CSS file is included only in first block so when we remove first block, including proper CSS disappears completely from page and styling for all other blocks is broken (non existing to be more specific).This PR uses this approach https://github.com/symfony/webpack-encore-bundle/tree/v1.16.1#rendering-multiple-times-in-a-request-eg-to-generate-a-pdf to reset internal cache.
Please be gentle in CR (:P), solution is taken in 100% from this fragment where similar case occurs: https://github.com/ezsystems/ezplatform-admin-ui/blob/aa7aa34282f46f65a7300368f5e955d484a74404/src/lib/EventListener/AdminExceptionListener.php
Argument
$fields
in methodContentService::prepareFields
expects array of string - field identifiers. This can be empty array but will never be a null.Checklist:
$ composer fix-cs
).@ezsystems/php-dev-team
).