- Issue created by @andy_w
- 🇬🇧United Kingdom andy_w
Its worth mentioning that menu link weight has a similar patch for a very similar observation,
The test bots don't test patches any more. Please would you open a merge request?
- First commit to issue fork.
I have a suggestion for a simpler change that might work.
MR also needs tests.
- 🇬🇧United Kingdom andy_w
As I understand it $entity->hasTranslationChanges() will only give us the output we are after if the menu is setup to use translation, which is why I wrote it off in the first place (though I could be wrong, and hope I am, as it would be a much nicer solution).
On a standard profile install, hasTranslationChanges() detects changes on the entity without content translation enabled.
- Merge request !10144Issue #3486604 by andy_w, godotislate: Node edit form re-saves menu items even... → (Open) created by andy_w
- Merge request !10184Issue #3486604 by andy_w, godotislate: doSave on menu tree storage still... → (Open) created by andy_w
- 🇬🇧United Kingdom andy_w
The actual issue here appears to stem from the fact that the doSave method on menu tree storage still returns the current menu even if no changes were detected - causing an unnecessary cache clear.
The code suggests an exit early state but it still returns with the current menu, causing follow on actions.
- 🇬🇧United Kingdom andy_w
It would appear that this was flagged as a follow up action many years https://www.drupal.org/project/drupal/issues/2302137#comment-12070910 → and further discussed here: https://www.drupal.org/project/drupal/issues/2876343 →
However this has a significant impact upon a sites performance if every time an editor saves a page in the menu system (without making a change to the menu) the whole site is essentially cleared from the cache.
- 🇬🇧United Kingdom andy_w
My assumption is that the failing tests (in unrelated aspects of the system) are based on the fact that they require a cache clear and are relying on an incidental cache clear to occur based on this change.
- 🇵🇱Poland dmitry.korhov Poland, Warsaw
@andy_w, shall we close this one and focus on https://www.drupal.org/project/drupal/issues/3485030 📌 MenuTreeStorage shouldn't invalidate cache tags if the menu didn't change Active instead?
- 🇬🇧United Kingdom andy_w
I agree @dmitry.korhov
Closed as duplicate of https://www.drupal.org/project/drupal/issues/3485030 📌 MenuTreeStorage shouldn't invalidate cache tags if the menu didn't change Active