F
Filamentā€¢16mo ago
Vladimir

Is there a thing like hot reload for Filament resources?

First time today, i have started working with Filament. What a blast! However, i am missing something. While developing with laravel/inertia/vue, or simply with laravel blade there is awesome thing called hot reloading, where all the changes i do are instantly visible in the browser without reloading. Does Filament have anything similar to it, so when i change FilamentResource i can see the change instantly without having to reload the page in browser?
Solution:
I added this to my AdminPanelProvider. It seems to be sufficient to fix the auto-refreshing when using Vite.
No description
Jump to solution
33 Replies
Patrick Boivin
Patrick Boivinā€¢16mo ago
I think you could use browsersync for this if you want to reload when you change .php files Not a hot reload, but maybe it can help...
Vladimir
VladimirOPā€¢16mo ago
Thank you Patrick. Much appreciate your time to reply. Will check if this will work for me. Thank you šŸ™‚
uarefans
uarefansā€¢16mo ago
Making Vite and Valet play nice together | freek.dev
Yesterday, the Laravel team launched the official vite-plugin. From now on, Vite will be the standard build tool for Laravel. The main benefits are vastly improved build times and a more straightforward API. Want to know more about it? Head over to the official docs. There's also a migration guide to go from Mix to Vite. When I followed that gui...
Vladimir
VladimirOPā€¢16mo ago
Thank you, but i think this is not related to my question šŸ™‚
uarefans
uarefansā€¢16mo ago
oke never mind, vite change without reload page valet need this code for work together with vite
Patrick Boivin
Patrick Boivinā€¢16mo ago
Simpler than BrowserSync.
Arnaud
Arnaudā€¢16mo ago
Same issue, not work :/
Vladimir
VladimirOPā€¢16mo ago
@pboivin thank you, tried that already, unfortunately this is not solving a challenge. In this case Vite is watching on livewire changes, not a filament. Maybe if filament template files are published (which is not recommended) and then tell vite where to watch for changes. ā¤ļø
Patrick Boivin
Patrick Boivinā€¢16mo ago
You can add more paths to the Vite config, like 'app/Filament/**'
Vladimir
VladimirOPā€¢16mo ago
Maybe i wasn't clear in description šŸ™‚ What i am trying to understand is how to change, let's say UserResource form or table in Filament directoy, and see the change in browser instantly šŸ™‚ Browser sync would work, but not plays for my need right now šŸ™‚ agree. I dont know where are Filament template files located šŸ˜„
Vladimir
VladimirOPā€¢16mo ago
this is what you mean i suppose:
Vladimir
VladimirOPā€¢16mo ago
ah
Patrick Boivin
Patrick Boivinā€¢16mo ago
Yes, that
Vladimir
VladimirOPā€¢16mo ago
not works too , just tried to add it as app/Filament/**
Patrick Boivin
Patrick Boivinā€¢16mo ago
Ok, I'm not sure unfortunately... I've never used it, just found it in the docs šŸ˜„
Vladimir
VladimirOPā€¢16mo ago
i must be missing something, should work that way thanks man, i ll update here if i find proper solution that works
Vladimir
VladimirOPā€¢16mo ago
half work - it does see change in Vite, but page is not reloaded:
DariusIII
DariusIIIā€¢16mo ago
Have you tried using ->poll() on your table?
Arnaud
Arnaudā€¢16mo ago
Maybe it's because your are on https mode, need extra configuration
nielsdscrd
nielsdscrdā€¢16mo ago
Although Filament's documentation mentions that you should use @vite('resources/js/app.js') when using your own Livewire components, Filament itself does not seem to include this. Hence the Vite listener is invoked on your regular pages, but not Filament panels.
Patrick Boivin
Patrick Boivinā€¢16mo ago
You need to configure a custom theme
Solution
nielsdscrd
nielsdscrdā€¢16mo ago
I added this to my AdminPanelProvider. It seems to be sufficient to fix the auto-refreshing when using Vite.
No description
Vladimir
VladimirOPā€¢16mo ago
This is the way! Thank you niels.
Arnaud
Arnaudā€¢16mo ago
Thanks ! How did you know we have to proceed this way ? Should be definitively in the doc !!!
Dennis Koch
Dennis Kochā€¢16mo ago
There is no reload via Vite if you don't add any files via Vite as the Vite client if not added to the site. So adding any file via Vite solves this.
Arnaud
Arnaudā€¢16mo ago
So simple in fact lol
gvan
gvanā€¢16mo ago
PHP 8.2.8 required the second parameter to be named as well: hook: fn (): string => Blade::render(string: "@vite('resources/js/app.js')"),
HL
HLā€¢16mo ago
For me, rendering app.js caused many problems in the console which I couldn't solve, so I simply made an empty js file and called it with the $panel->renderHook() method:
$panel
->renderHook(
'panels::body.end',
fn (): string => Blade::render("@vite('resources/js/empty.js')"),
)
$panel
->renderHook(
'panels::body.end',
fn (): string => Blade::render("@vite('resources/js/empty.js')"),
)
Patrick Boivin
Patrick Boivinā€¢16mo ago
Folks, if it works it works, I guess... but what's the issue with using a custom theme? You get all this and much more room to grow.
HL
HLā€¢16mo ago
The default theme looks awesome šŸ™‚
Patrick Boivin
Patrick Boivinā€¢16mo ago
Sure, so just leave the defaults. The custom theme just implies taking ownership of the Tailwind + Vite layer.
HL
HLā€¢16mo ago
I'll look into it, thank you
Want results from more Discord servers?
Add your server