-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[Bug]: Static pages are missing Webpack-Encore includes #16220
Copy link
Copy link
Closed
Labels
Milestone
Description
Pimcore version
11.1.0
Steps to reproduce
- Set up a Pimcore Project with Webpack Encore Bundle Integration
- I prepared a minimal demo project based on pimcore/skeleton and the manuals of the WebpackEncoreBundle and the Encore installation manual
- Pepare the pages
- Enable static page generation for the root page with a lifetime of 1 minute
- Create and publish another page and use the same setting
- Wait for the maintenance job (
\Pimcore\Maintenance\Tasks\StaticPagesGenerationTask) to refresh the pages or callpimcore:maintenancemanually. Wait at least a minute to make sure both pages are refreshed at the same time.
Actual Behavior
The style and JS includes are only present in one page. In all other pages they are missing (the background is no longer grey).
The reason for this problem can be found in the Encore logic:
- The
\Symfony\WebpackEncoreBundle\Asset\EntrypointLookupwill only return the files that should be included once until the$returnedFilesproperty is reset. - This is normally done by the
\Symfony\WebpackEncoreBundle\EventListener\ResetAssetsEventListenerat thekernel.finish_requestevent - The event is triggered during document generation but the reset is not executed because the method
\Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer::render()uses a sub-request. In that case the reset is skipped.
Expected Behavior
The styles are included in all pages.
The problem can be solved by using an event listener that manually resets the entrypoint lookup on the pimcore.document.renderer.post_render.
I'm not sure if this is something that should be provided by the Pimcore core of if it only should be documented somewhere.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Type
Fields
Give feedbackNo fields configured for issues without a type.