Problem/Motivation

After deploying breadcrumbs will break depending on which language is visited first. E.g. if you visit about on spanish first after deploying then the spanish breadcrumb will be correct, but the english breadcrumb will be just `Home` This also happens in reverse if the english site is visited first after a deploy.

Clearing the cache in the ui fixes the breadcrumbs for both languages at least temporarily

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicxvan created an issue. See original summary.

nicxvan’s picture

@greg-boggs pointed me at a similar solution in easy breadcrumb. If this gets merged please include him in the credit.

Greg Boggs made their first commit to this issue’s fork.

nicxvan’s picture

Here is a patch file for deployments

Sutharsan’s picture

Status: Active » Needs work

This duplicates adding the route and url.path context. However, without this breadcrumbs still disappear occassionally.

This comment gives me an uncomfortable feeling, it sounds like a hack to me. Do we understand why the bug occurs?

Sutharsan’s picture

It would be beneficial to have at least the steps to reproduce the problem, i.e. which Drupal setup. Some suggestion: Interface translation y/n, content translation y/n, menu translatable y/n, menu-items translatable y/n, url alias differs per language y/n, active trail differs per language y/n

I don't experience the problem in my set-up (yet), but I do have collected the cache contexts of the breadcrumb block (used renderviz module):

  • "languages:language_content",
  • "languages:language_interface",
  • "route.menu_active_trails:main",
  • "url.path",
  • "user.permissions"
nicxvan’s picture

Thank you for responding, I am not sure what you mean about the change being unrelated.

It is a bit hard to reproduce but I will answer your questions.

We do have some interface translation but not for breadcrumbs.
Content, menu, menu items are all translated.

The url alias is the same on both languages, but we use the path '/es' to handle language negotiation.
The active trail is the same on both.

nicxvan’s picture

This may not be related to the languages. I found a core bug that has the exact same behavior:

https://www.drupal.org/project/drupal/issues/2875276

If I clear the cache while on the home page then no breadcrumbs ever show up.

renatog’s picture

@nicxvan do you know the steps to "how to reproduce" that?

I have a similar issue that that breadcrumb doesn't appear in some languages in production, but is working fine locally. I have a guess that is related to memcached. But I'm not really sure. I'm curious because seems to be similar

nicxvan’s picture

@renatoG I've never been able to fully pin down the cause. We don't use Memcache anymore so it's not likely related to that.

stefan.korn’s picture

I also experienced this issue, little different. All of a sudden menu breadcrumb stopped working. Finally found out that it was related to facet pretty paths and Search API. There was a node that had the same URL Alias as a search display. As soon as I renamed the node and cleared the cache, menu breadcrumb was working again.

It seemed that facet pretty paths somehow added its query parameters to all node requests and thus menu breadcrumb did not find itself responsible anymore (applies method) for any nodes. Strange enough that this kills all node breadcrumbs ...

phjou’s picture

I am also experiencing something similar, but in case I identified that the breadcrumb breaks everytime I visit a node.

Example:
-- Visit custom route, breadcrumb show
-- Visit node
-- Visit same custom route, breadcrumb disappears

And I need to flush the cache in order for the breadcrumb to reappear on the custom route.

EDIT: was the fault of a custom preprocess that was emptying the whole content including the cache tags.

xurizaemon’s picture

Version: 8.x-1.16 » 2.0.x-dev
Status: Needs work » Postponed (maintainer needs more info)

There is a Menu Breadcrumb fix related to route parameter matching in #3392139: Wrong breadcrumb due to route alterations which might be of interest. Thanks for linking #2875276: Breadcrumbs disappears when starting with front-page after cache rebuild (for anonymous user). as well Nic.