Skip to content

Lazy Loading activitylog.css to Prevent Unnecessary Conflicts and Asset Overload #48

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

byteforge-code
Copy link

This pull request introduces the loadedOnRequest() method to prevent the activitylog.css file from being loaded automatically. This change follows the official Filament documentation for lazy-loading assets.

Problem:
The current implementation injects activitylog.css globally, wherever the @filamentStyles directive is used. This includes the admin panel, custom pages, and any Livewire or normal Blade pages. As a result, it leads to:

  • Unnecessary conflicts with other stylesheets.
  • Increased asset size and load times, even when activitylog.css is not needed.

Solution:
By applying the loadedOnRequest() method, we ensure that activitylog.css is only loaded when explicitly requested, reducing unwanted style conflicts and improving asset performance.

@rmsramos rmsramos merged commit d0b204d into rmsramos:main Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants