Hello
i have the newest Version of Drupal and the Breadcrumbs hangs.

When i click at fist on a article the Breadcrumb is correct. But then on the next article comes the old Breadcrumb.
It hangs.
Cache is not activated.
It is a fresh Drupal 8 with no changes.
And i have testet it with simplytest.me.
And with the newest Dev Version of the Theme.
Then i have test it with a other Theme (Bootstrap Theme) and the Breadcrumbs not hangs.

At first install Drupal no canges. A fresh Drupal.
1
2
3
4
5

Then write two article.

6
7
8
9
10
11
12
13
14

The install a Theme with Breadcrumbs. I test it with the Theme from https://www.drupal.org/project/nexus. But it's the same with other Themes.

15
16

Then open post 2.

17
18

Article 2. is opened.
All ok it stands 2 in the Breadcrumb

Then open first Article (1.)

19
20

And you see it is false. Ist must be 1 in the Breadcrumb. The Cache is not of Drupal is not activated. But when you clear the Cache the first oppened Breadcrumb is ok but the it comes the same.

Comments

rothlive created an issue. See original summary.

rothlive’s picture

Issue summary: View changes
rothlive’s picture

Issue summary: View changes
jfurnas’s picture

I can confirm that this is an issue. I was coming here to create an issue myself and noticed it.

Deepika.chavan’s picture

Hi,

I fixed this issue by adding following line in 'nexus.theme' file:
$variables['#cache']['contexts'][] = 'url';
i.e. I changed

function nexus_preprocess_breadcrumb(&$variables) {
  if(($node = \Drupal::routeMatch()->getParameter('node')) && $variables['breadcrumb']){
    $variables['breadcrumb'][] = array(
      'text' => $node->getTitle(),
      'url' => $node->URL()
   );
  }
}

to

function nexus_preprocess_breadcrumb(&$variables) {
  if(($node = \Drupal::routeMatch()->getParameter('node')) && $variables['breadcrumb']){
    $variables['breadcrumb'][] = array(
      'text' => $node->getTitle(),
      'url'  => $node->URL()
   );
    $variables['#cache']['contexts'][] = 'url';
  }
}

Hope that helps!!

Regards,
Deepika Chavan

FlorianLeoC’s picture

Thanks Deepika Chavan - works for my installation, so far

dipakmdhrm’s picture

Status: Active » Needs review
StatusFileSize
new549 bytes

@Deepika Chavan: Thank you for the suggestion. Good catch on the missing cache context!
I've created a patch based on it.

yogeshmpawar’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new50.26 KB
new49.96 KB

I have manually apply the patch & tested the patch. it is working as expected.
so marking this issue as "RTBC" & also adding the screenshots.

dipakmdhrm’s picture

Status: Reviewed & tested by the community » Fixed

Marking as fixed! Thank you everyone for your help.

rothlive’s picture

Great !
@ Deepika.chavan thank you for the Help. And everyone other.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.