Loading
Render the inbox table in a placeholder, so the inbox page can be cached
Closes https://www.drupal.org/project/orchestra/issues/3628886
The inbox page was never cached: its task table carries the user context, which reached the response, so the Dynamic Page Cache answered UNCACHEABLE (poor cacheability) on every visit. The table had no #cache keys either, so nothing cached it.
InboxController::buildInbox()now returns an always-placeholdered#lazy_builderwith#cachekeys. The page shell is cached once per permission set; the table is render-cached per user, tenant and URL, with the tags and max-age it already declared.- The placeholder is a
tablechild of the page array, not the array itself:HtmlRendereradds#cache_propertiesto main content that has#cachekeys, and an element with a#lazy_buildermay carry no other property (an assertion, so a 500 whereverzend.assertionsis on). - The lazy builder is
InboxController::buildTable()(trusted callback), instantiated by core's callable resolver throughcreate(), so no new service. - The table reads the return URI from the request stack instead of taking an argument: the Dynamic Page Cache keys the shell by route, not query string, so an argument would be replayed from the cached shell to another page of the pager. It adds the
urlcontext for the same reason. TaskInboxTest::testInboxPageIsCachedPerOperator()(dynamic_page_cache enabled): MISS then HIT on the inbox; the Claim link returns to the current request's query string, not the cached one's; a second operator with the same role, at the same URL the first one's table is cached under, gets a HIT without the task the first one claimed (dropping theusercontext from the table fails it). Thetest-only changesjob confirms it fails without the fix: the first visit answersUNCACHEABLE (poor cacheability)whereMISSis expected.- Kernel tests (
WorkItemPresentationTest,EmbeddedTaskTest,InteractionTaskTest) callbuildTable();testInboxLinksCarryReturnpushes its request, with a query string, onto the stack. WorkItemPresentationTest::testInboxPageRenders()sends a real request throughhttp_kernel, so the page renderer runs; with the placeholder as the page array itself it fails on that assertion.
Edited by Frank Mably