Generated with the help of an LLM.
Problem/Motivation
ComponentPluginManager caches component definitions containing absolute filesystem paths. ComponentLoader subsequently uses these paths to load component templates.
In a multi-webhead environment where webheads share a discovery cache but have different application roots (such as timestamped release directories), cached component definitions can reference paths that do not exist on other webheads.
This results in errors such as:
file_get_contents(.../components/navbar/navbar.twig): Failed to open stream: No such file or directory
Steps to reproduce
- Configure two webheads with different absolute application roots and a shared discovery cache backend.
- Rebuild caches on the first webhead.
- Render an SDC component on the first webhead to populate the component definitions cache.
- Render the same component on the second webhead.
The second webhead attempts to load the component template using the first webhead's absolute filesystem path.
Proposed resolution
Store component paths relative to the application root in cached definitions and resolve absolute paths at runtime.
As a workaround, a module service provider can scope the component definitions cache key to the application root while assigning a shared cache tag to preserve cross-webhead invalidation.
Remaining tasks
- Confirm reproduction using core SDC without contributed modules.
- Identify consumers of cached component paths.
- Implement and review the proposed resolution.
- Add regression test coverage.
User interface changes
None.
Introduced terminology
None.
API changes
To be determined. Consumers of component definitions may currently expect absolute paths.
Data model changes
No database schema changes anticipated. The representation of cached component paths may change.
Release notes snippet
Fixed an issue where Single-Directory Components could fail to render in multi-webhead deployments using a shared discovery cache and different application roots.
Comments