Skip to content

[BUGFIX] Tag menu cache entries with their entry points - #132

Open
wazum wants to merge 1 commit into
b13:mainfrom
plan2net:bugfix/empty-menu-cache-tags
Open

wazum wants to merge 1 commit into
b13:mainfrom
plan2net:bugfix/empty-menu-cache-tags

Conversation

@wazum

@wazum wazum commented Nov 12, 2026 •

Copy link
Copy Markdown

Fixes #131
Related: #115

Menu cache entries are now also tagged with menuId_<id> of their entry points, not only with tags derived from the result. An empty menu gets at least these tags, both on the hash cache entry and on the page cache entries that render it.

When an entry point (or its translation, the DataHandler hook uses the default language uid) changes, menuId_<entryPoint> is flushed and the menu is built again.

Changes

  • CacheHelper::get() takes optional $entryPointIds and adds their menuId_* tags on cache hit and cache miss.
  • TreeMenuCompiler passes its entryPoints, ListMenuCompiler passes its pages.
  • LanguageMenuCompiler is unchanged: its result always contains the current page, so it can't end up empty because of a missing entry point.
  • Breadcrumbs don't use the menu cache, so nothing to do there.

Tests

  • New functional test EmptyMenuCacheTest: strict second language, the translated entry page is hidden, so the menu is empty. Unhiding the translation through the DataHandler rebuilds the menu. Fails without the fix, passes with it.
  • ListMenuProcessorTest::menuIdTagsAreAddedToPageCache expects the extra tags of the listed pages now.

Functional tests, phpstan and CGL pass locally on TYPO3 13 and 14.

Relation to the bugfix/menu-cache-tags branch (#115)

This PR doesn't cover nested pages that are missing from a non-empty menu (e.g. 1 → 2 → 3 with page 3 hidden). That's #115, and the bugfix/menu-cache-tags branch handles it. I applied both changes together locally and all functional tests pass, including the nested cases from that branch.

The source changes merge cleanly. The only conflict is in the expected tags of ListMenuProcessorTest::menuIdTagsAreAddedToPageCache. Keep the lists from this PR, they include the tags from that branch.

@wazum
wazum force-pushed the bugfix/empty-menu-cache-tags branch from 16df806 to 7361279 Compare November 12, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty menus are cached without tags and are not flushed when pages change

1 participant