Node changes (title change, publish/unpublish) don't get updated to the breadcrumb.
Example steps to reproduce:
- Install and configure varnish
- Install and configure purge, varnish_purger and suitable set of submodules
- Create a node unpublished
- Try to show the node without an access to view unpublished nodes
- Publish it
- Reload the page, notice a breadcrumb with "Access denied" instead of current page title
Running drush p-queue-work doesn't help as expected, but cache-rebuild does the trick (on an empty dev site, on another site it doesn't somehow affect either...). It's not a proper workaround anyway.
Also, the title stays there in the breadcrumb when unpublishing a node. If I add
if ($node = $route_match->getParameter('node')) {
$breadcrumbs->addCacheTags(['node:' . $node->id() ]);
}
to BreadcrumbBuilder.php, the breadcrumb gets updated instantly on node unpublish, but this doesn't help on other cases.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | page-title-cache-2871340-8.patch | 1.4 KB | porchlight |
| #3 | current_page_crumb-cache-fix-2871340-3.patch | 698 bytes | jhuhta |
Comments
Comment #2
greg boggsHi Jhuhta,
Can you look at the addCacheTags call from easy_breadcrumb and try that code in here? I'd do it, but replicating your set up is a few steps, and I've got a super busy week ahead.
Comment #3
jhuhta commentedSure I would, but there's no addCacheTags() call in easy_breadcrumb. Only these:
First of which is already there in current_page_crumb, and the latter, well, the module has no config.
I have to correct myself. The three lines code in the summary fixes the breadcrumb updating on node title change. Hence the patch.
The "access denied" problem still persists and it's not varnish related: publishing an previously unpublished node still shows "access denied" in the breadcrumb until cache-rebuild.
Comment #4
khiminrm commentedHi!
Patch from #3 works for me for updating breadcrumb after editing node's title.
Thanks!
Comment #5
greg boggsSo, if I'm following this thread correctly, this will fail for entities, users and taxonomy terms as well? And it will fail in both Breadcrumb modules for D8?
Comment #6
tea.time commentedNoting that I replicated this issue and that the patch in #3 fixed it for me, for node page breadcrumbs.
However, I imagine Greg is right in #5, that the problem would affect any entity whose label sets the page title... I have never fully understood where the entity view routes were provided, so I looked it up, and it seems this class does so - the `canonical` route:
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Entity%21...
So I think one way to be truly dynamic would be to check if the current route matches an `entity.[entity_type_id].canonical` route, and then add that entity's cache tags...?
Comment #7
greg boggsComment #8
porchlight commentedAttaching a patch based off easy_breadcrumb implementation and comment #7.
Comment #10
greg boggs