breadcrumbs icon indicating copy to clipboard operation
breadcrumbs copied to clipboard

Breadcrumb trail removed after calling livewire method via blade

Open marcoluzi opened this issue 11 months ago • 2 comments

Expected Behavior

When I implement the breadcrumbs into a livewire full page component according to the documentation, it should keep its trail upon component update.

Actual Behavior

After a full page component update, the breadcrumb trail is removed except for home.

Steps to Reproduce the Problem

  • Full Page Component: https://github.com/marcoluzi/lingua-vault/blob/a9144d78512de299bdb6e561f063f3c5216c629a/app/Livewire/Pages/Lessons.php
  • Full Page View: https://github.com/marcoluzi/lingua-vault/blob/a9144d78512de299bdb6e561f063f3c5216c629a/resources/views/livewire/pages/lessons.blade.php
  • Page Header Component: https://github.com/marcoluzi/lingua-vault/blob/a9144d78512de299bdb6e561f063f3c5216c629a/app/Livewire/Components/PageHeader.php
  • Page Header View: https://github.com/marcoluzi/lingua-vault/blob/a9144d78512de299bdb6e561f063f3c5216c629a/resources/views/livewire/components/page-header.blade.php

After the page is loaded, change the sorting order using the dropdown. After the new order is applied, all items except for the home item get removed from the breadcrumbs.

Specifications

App runs inside laravel sail container.

marcoluzi avatar Feb 14 '25 13:02 marcoluzi

I did some more debugging. It's not tied to general full page component update but rather to calling livewire component methods via blade. For example, the sorting dropdown uses @click='open = false; $wire.sortBy("title")' on the individual dropdown items. It breaks on click. I have another full page component that utilizes the same method using @click="open = false; $wire.setLanguage('fr')". Those are the only two instances where the trail gets removed.

marcoluzi avatar Feb 20 '25 08:02 marcoluzi

I also tried the following things without success:

  • Replacing @click with x-on:click
  • Removing open = false;
  • Adding trailing ; to $wire.sortBy("title")/$wire.setLanguage('fr')

marcoluzi avatar Feb 20 '25 08:02 marcoluzi