- Issue created by @dxvargas
- 🇵🇹Portugal dxvargas
I'm providing a patch that should fix the problem. When saving alerts, it's invalidating the new cache tag "sitewide_alert", that is later used in the build of the render array.
We always need to apply the cache metadata to the build, otherwise the cache doesn't bubble correctly to the alert block in the submodule. This led to some refactoring of
\Drupal\sitewide_alert\SitewideAlertRenderer::build().I'm providing a functional test that was already passing before applying the fixes!
- 🇧🇪Belgium victonator
Hi, We bumped into this issue and the fix works as expected.
- 🇵🇹Portugal dxvargas
[@alorenc] about your remark:
I am not entirely sure about the additional condition: "or if no active alerts" option."
This condition, and the associated logic, was already there. I just moved it up and used the cache also in that case.
This comes from the related issue:
#3480439: Unnecessary invocation of sitewide_alert/load route when no active alert exists increases server load
I've added a comment there before. I think it's debatable if the change there makes sense. But it's a different topic.
Here we should keep the existing logic. - 🇵🇱Poland alorenc Wolsztyn, 🇵🇱
It is a fair argument, condition already exists.
Looks fine, Cache Tags were added