Fix notifications asset caching

This commit is contained in:
root
2026-01-31 06:53:56 +02:00
parent 72221b4a63
commit 6fb4b6beef
3 changed files with 39 additions and 0 deletions

View File

@@ -6,7 +6,10 @@ use App\Models\Domain;
use App\Observers\DomainObserver;
use App\Support\Notifications\Notification as LivewireNotification;
use Filament\Notifications\Notification;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\File;
class AppServiceProvider extends ServiceProvider
{
@@ -25,6 +28,14 @@ class AppServiceProvider extends ServiceProvider
{
Domain::observe(DomainObserver::class);
$versionFile = base_path('VERSION');
$appVersion = File::exists($versionFile) ? trim(File::get($versionFile)) : null;
FilamentAsset::appVersion($appVersion ?: null);
FilamentAsset::register([
Js::make('notifications', public_path('js/app/notifications.js')),
], 'app');
// Note: AuthEventListener is auto-discovered by Laravel 11+
// Do not manually subscribe - it causes duplicate audit log entries
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
@if (isset($data))
<script>
window.filamentData = @js($data)
</script>
@endif
@foreach ($assets as $asset)
@if (! $asset->isLoadedOnRequest())
@php
$skipNotificationScript = $asset instanceof \Filament\Support\Assets\Js
&& $asset->getPackage() === 'filament/notifications'
&& $asset->getId() === 'notifications';
@endphp
@if (! $skipNotificationScript)
{{ $asset->getHtml() }}
@endif
@endif
@endforeach
<style>
:root {
@foreach ($cssVariables ?? [] as $cssVariableName => $cssVariableValue) --{{ $cssVariableName }}:{{ $cssVariableValue }}; @endforeach
}
@foreach ($customColors ?? [] as $customColorName => $customColorShades) .fi-color-{{ $customColorName }} { @foreach ($customColorShades as $customColorShade) --color-{{ $customColorShade }}:var(--{{ $customColorName }}-{{ $customColorShade }}); @endforeach } @endforeach
</style>