extraAttributes on Form components
The class exists in my theme, I ran the build command, and yet its not executet/found when the page loads 🤔
63 Replies
Make sure the directory/file is included in your content for your tailwind.config.js.
Be cautious though, I’ve found that tailwind’s purge can have issues with php class files.
Can you please elaborate? What do you mean by this?
Also, this is the tailing.config.js of my theme
And this is in a Resource file, which means its already included
But I still cant see changes
In fact, now that I checked the console, I have this error? 🤔
Even if I comment the ->extraAttributes() I still get the errors
Issue is on github: https://github.com/filamentphp/filament/issues/10185
But the errors, shouldnt really matter, right?
Anyone?
Do you have any views published by any chance?
No, I dont:/. This is from a resource
Hmm. I just think if it was a core issue it would have been escalated since the error seems like it would break everyone’s app. Maybe delete the vendor folder and try a fresh composer install.
Or make sure you’re running ‘artisan filament:upgrade’ after every composer update.
I have done both actually 😅
But filament:upgrade doesnt overwrite the published files
Filament upgrade calls filament:assets that will force publish the css and js asset files.
I still get it
are you sure it isnt related to this?
Are you possibly manually including alpine in a js file somewhere.?
hm, doubt it. But I will check
I’m not sure, but non of my apps are breaking with extraAttributes
Actually, as mentioned here, it breaks even without extraAttributes
Then my apps aren’t breaking that way either. Lol.
Mine breaks when I use the Toggle on the header of Filter (Above Layout)
Actually, scratch that. When I user either component
There is no toggle filter. It should be Filter::make()->toggle()
But even without it I get errors
Since im in a form, the components must of of type form, not filter
Yea. You’re calling form on a filter. I’m not sure that works.
it works
Not sure then. Sorry.
Okk. Thanks. I will open a discussion on github
I just don’t understand why a filter would have a form when the make() ties the filter to a field. Unless it was maybe a relationship. And there’s nothing in the docs about a filter supporting a nested form.
Unless it was a custom filter.
It isnt haha
Ok.
The Filter component you see is
use Filament\Tables\Filters\Filter
Also, afaik, that is the only way to have all filters on the top, where they "work on the query together"
Idk how to phrase it 😅Right, but what I’m getting at and not that you are wrong, is that a filter is a form component that is bound to a property on the model. So calling form() on a filter doesn’t make sense to me.
And you can have any filter any where you want.
Actually, ite mentioned here: https://filamentphp.com/docs/3.x/tables/filters/custom
Even though it says custom
Exactly, custom filters, which you said this wasn’t a custom filter.
Yeah, my bad
But, it shoudlnt matter, yes?
Of course it matters. Otherwise it wouldn’t be custom.
But if you are using Filter and not a class that extends Filter then it isn’t custom.
Im not using a class that extends Filter. Its like this:
That’s my point you’re trying to use custom filter functionality, but on your table you are using the core filter. Instead of a custom filter.
So what should I do now?
Create a custom filter. 🙂
Im sorry, I dont understand how that is different from what I have now? 😅
Both use Filter::make()
Like, create a new class?
Yes. A new class that extends the filter class.
When you use Filament\Tables\Filters\Filter you are not using a custom filer. You are using the core filter that is bound to a model property based on what is defined in the make() modifier. It is not custom.
Sorry, I see what you’re getting at now.
So I make a new component with
php artisan make:compoent
No, don’t do that.
Yeah sorry as well. I didnt know thats what the doc meant to say
I’m thinking about it wrong. Sorry.
no problem:)
The error doesn’t make sense in the context though. Not sure what’s going on.
This is so weird
I get the error every time I interact with a filter
no matter where it is
But I dont think that is the reason why I cant apply atributes
Do you have other filters too.?
Yes?
Wait no
Not in this case
But in other resources yes
Maybe the issue isn’t with this particular filter.
It isnt
Hm
Taking a stab in the dark.
Other filters could affect the query. But what doesn’t make sense is that it’s throwing an alpine error.
Do you have opcache, by any chance?
I do!
Try clearing that cache.
But I installed opcache just a couple of hours ago
yeah, I already did
That was my last guess. Lol.
I have a command that clears everything:
So, it should apply attributes, right?
Technically
Yes
Then, I will wait for Dan to fix the Issue, and we'll see from there
Ok
Thanks for your effort:)
Apparently it’s a bug in livewire. Dan can’t fix that. Hopefully Caleb can address it soon.
wowow okk. Thanks for letting me know