rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.7k stars 320 forks source link

[Bug]: Auto injection is triggered on non-Livewire pages #1587

Closed dmyers closed 5 months ago

dmyers commented 6 months ago

What happened?

I noticed that the core and 3rd party assets are loaded on every page, regardless if there is a table on the page or not.

Is it possible that I could either manually load these in a parent view I have or, make it so that they only are loaded on pages that have the Livewire table loaded somehow?

Or maybe with a directive? Like @livewireTables. Or could this be in the Livewire views with a @once or something?

How to reproduce the bug

No response

Package Version

3.1.4

PHP Version

8.2.x

Laravel Version

10

Alpine Version

3

Theme

Tailwind 3.x

Notes

No response

Error Message

No response

dmyers commented 6 months ago

I just discovered that there are directives already. Very awesome. They just don't seem to be listed anywhere in the docs that I could find here: https://rappasoft.com/docs/laravel-livewire-tables/v3/start/including-assets

Here they are if anyone else needs them. @lrljoe I will close this, but let me know if you want help with the docs.

I still think something is wrong with the auto injection though, affecting any route I have that has <html></html> in it and seems to behave different than Livewire as it doesn't have the same problem in my tests.

    @rappasoftTableStyles
    @rappasoftTableThirdPartyStyles
    @rappasoftTableScripts
    @rappasoftTableThirdPartyScripts
lrljoe commented 6 months ago

Will make sure to update the docs for next release!

stale[bot] commented 5 months ago

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.