rappasoft/laravel-livewire-tables

[Bug]: hideBulkActionsWhenEmpty is not working

rpringadi opened this issue · 10 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

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.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Will be fixed very soon!

shawe commented

Interested in the same issue, I see now that alwaysShowBulkActions never changes to true.

Yeah, it's on the to-do list for the next week, apologies for the delay. I've got a local fix, which corrects the issue, and also renames the JS property so that it matches the backend.

Should be in next week, PR is here #1747 and it is now in the "development" branch (should you wish to test!).

Now released as v3.2.8, please advise if anything not as expected!

shawe commented

Still happening to me @lrljoe

image

image

Maybe publish again the resources view folder?

shawe commented

For me the problem seems to be related with the command for publish the views to resources/views/vendor/livewire-tables

I removed the folder and launch the command again and this issue disappear.

You do not need to publish the views, unless you are making changes to them.

It is recommended not to do so!

shawe commented

You do not need to publish the views, unless you are making changes to them.

It is recommended not to do so!

I need to do it, to replace some theme diffs.