sidebar.end not working on remote server, but works on localhost
Hi guys, it is a question about filament 2.x version, I used registerRenderHook 'sidebar.end' to show a little footer on sidebar.
It works on localhost but when I deploy both to staging and production servers, it won't show up. I will go nutz, could not find anything useful. Does anyone know why this may happen?
Here is AppServiceProvider.php
Filament::registerRenderHook(
'sidebar.end',
fn (): View => view('filament.resources.sidebar.footer')
);
And here is the blade (/filament/resources/sidebar/footer.blade.php):
<div style="position: fixed;
left: 0;
bottom: 0;
width: 100%;
text-align: center;
padding-bottom: 24px;
font-size: 14px;">
<img src="{{ asset('/images/logo.png') }}" alt="" style="width: 120px; height: auto; margin: auto; display: block;">
v{{Config::get('app.version')}}
</div>
Thanks.
You may refer to the images attached to this message.9 Replies
Cached views on production maybe?
Or cached styles.
After a deploy I manually trigger php artisan optimize:clear, is this the cache, I cleared the chrome cache also but nothing change. Are there any other commands to clear cache?
Did you rerun npm run build?
Could be opcache too if you’re using that.
yes I ran, the strange thing is when I restart all supervisor commands on the server (
supervisorctl restart all
) first the sidebar.end appears, then after I refresh the page the hook disappears again.
I put a tiny log on the FilamentManager.php
from vendor to
public function renderHook(string $name): Htmlable
it logs out hook at first success then after refresh the hook object gets null.This log is called in
public function renderHook(string $name): Htmlable
function. This is after supervisorctl restart all
, I put only a "hello" to check if the blade was wrong but everything ok. It showsAfter I refresh page on chrome, it logs like this;
the hook of "sidebar.end" display as empty
Any suggestions :/
Sorry. I’m not sure. Something on your server is messing with your views.
If anyone experience this issue, my problem is because I directly called
Filament::registerRenderHook(
'sidebar.end',
fn (): View => view('filament.resources.sidebar.footer')
);
after boot method in AppServiceProvider.
I changed it in Filament::serving function, now it works fine.
Final code looks like this:
public function boot()
{
...
Filament::serving(function () {
....
Filament::registerRenderHook(
'sidebar.end',
fn (): View => view('filament.resources.sidebar.footer')
);
});
...
}