laravel-livewire-tables icon indicating copy to clipboard operation
laravel-livewire-tables copied to clipboard

[Bug]: hideBulkActionsWhenEmpty is not working

Open rpringadi opened this issue 2 months ago • 1 comments

What happened?

My understanding is if we want to keep showing the bulk action button, we can do the following:

        $this->hideBulkActionsWhenEmpty = false;
        $this->setHideBulkActionsWhenEmptyStatus(false);

I tried that, but that doesn't work. Looking into the code closely, we have this file:

// resources/js/laravel-livewire-tables.js  - line 11

alwaysShowBulkActions: !wire.entangle('hideBulkActionsWhenEmpty'),

The wire.entangle('hideBulkActionsWhenEmpty'), actually returns an object instead of a simple true/false.

{
  "initialValue": false,
  "_x_interceptor": true
}

I guess the proper code should be the following? -- just guessing.

alwaysShowBulkActions: !wire.entangle("hideBulkActionsWhenEmpty").initialValue,

How to reproduce the bug

  public function configure(): void
    {
        ...
        $this->hideBulkActionsWhenEmpty = false;
        $this->setHideBulkActionsWhenEmptyStatus(false);
    }

Package Version

3.2.4

PHP Version

8.2.x

Laravel Version

10.48.4

Alpine Version

3.13.8

Theme

Tailwind 3.x

Notes

No response

Error Message

No response

rpringadi avatar Apr 23 '24 14:04 rpringadi

Won't be initial value, as the entangle keeps it synchronised with the backend. Certainly not working though, will have to see where it became broken, give me til the end of the week.

lrljoe avatar Apr 29 '24 00:04 lrljoe