Menu entity should clear plugin.manager.block even when block module not installed

Created on 31 July 2018, about 6 years ago
Updated 6 February 2023, over 1 year ago

Problem/Motivation

The plugin.manager.block cache is cleared when menus are saved only when the block module is installed. However the plugin.manager.block is a core service not a block service.

Proposed resolution

Remove the module exists check.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
Menu systemΒ  β†’

Last updated 1 day ago

Created by

πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Reviewed the changes and removing the moduleExist check looks good.

    Ran the tests locally to make sure they fail and got

    Failed asserting that an array has the key 'system_menu_block:another_menu'.
    

    Which is expected.

    Looks good!

  • Status changed to Needs work over 1 year ago
  • πŸ‡¬πŸ‡§United Kingdom catch

    If used a memory cache for the static cache, we could rely on cache tags here, cross-linking 🌱 [policy] Standardize how we implement in-memory caches Needs work .

    One nit on the patch itself:

    +++ b/core/modules/system/src/Plugin/Derivative/SystemMenuBlock.php
    @@ -44,6 +44,8 @@ public static function create(ContainerInterface $container, $base_plugin_id) {
        * {@inheritdoc}
        */
       public function getDerivativeDefinitions($base_plugin_definition) {
    +    // Reset the discovered definitions.
    +    $this->derivatives = [];
         foreach ($this->menuStorage->loadMultiple() as $menu => $entity) {
    

    This needs a better comment - why do we need to reset the property every time it's called?

Production build 0.71.5 2024