Skip to content

Conversation

@Boy132
Copy link
Member

@Boy132 Boy132 commented Dec 20, 2025

No description provided.

@Boy132 Boy132 self-assigned this Dec 20, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 20, 2025

📝 Walkthrough

Walkthrough

Modified the plugin installation process to refresh cached Filament components. Added an explicit import for the Filament facade and introduced logic to iterate through all registered Filament panels, clearing cached components after migrations and seeders execute.

Changes

Cohort / File(s) Summary
Plugin Installation Cache Clearing
app/Services/Helpers/PluginService.php
Added import for Filament\Facades\Filament. Enhanced installPlugin() method to iterate through all Filament panels via getPanels() and invoke clearCachedComponents() on each panel after running migrations and seeders, ensuring cached components are refreshed post-install.

Pre-merge checks

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: clearing Filament cache when installing a plugin, which matches the code modification that adds clearCachedComponents() calls to the installPlugin method.
Description check ✅ Passed No pull request description was provided by the author. While a description would have been helpful, the absence of one does not constitute a failure since the title clearly describes the change and the code is straightforward.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/Services/Helpers/PluginService.php (1)

316-335: Consider adding cache clearing to uninstallPlugin.

The installPlugin method now clears cached Filament components, but uninstallPlugin does not. When a plugin is uninstalled, its components should also be cleared from the cache to prevent stale references.

🔎 Suggested fix to add cache clearing in uninstallPlugin
 public function uninstallPlugin(Plugin $plugin, bool $deleteFiles = false): void
 {
     try {
         $pluginPackages = json_decode($plugin->composer_packages, true, 512);

         $this->rollbackPluginMigrations($plugin);

         if ($deleteFiles) {
             $this->deletePlugin($plugin);
         } else {
             $this->setStatus($plugin, PluginStatus::NotInstalled);
         }

         $this->buildAssets();

         $this->manageComposerPackages(oldPackages: $pluginPackages);
+
+        foreach (Filament::getPanels() as $panel) {
+            $panel->clearCachedComponents();
+        }
     } catch (Exception $exception) {
         $this->handlePluginException($plugin, $exception);
     }
 }
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 242a75b and 33b71cc.

📒 Files selected for processing (1)
  • app/Services/Helpers/PluginService.php (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/Services/Helpers/PluginService.php (3)
app/Providers/Filament/AdminPanelProvider.php (1)
  • panel (16-56)
app/Providers/Filament/AppPanelProvider.php (1)
  • panel (13-40)
app/Providers/Filament/ServerPanelProvider.php (1)
  • panel (17-55)
🔇 Additional comments (2)
app/Services/Helpers/PluginService.php (2)

10-10: LGTM!

The Filament facade import is correctly added and necessary for the cache clearing functionality introduced below.


292-294: Cache clearing after plugin installation is appropriate.

The placement of clearCachedComponents() after migrations and seeders ensures newly registered plugin components are discovered on the next request. This approach is sound for plugin installations.

@Boy132 Boy132 merged commit 1d5ace3 into main Dec 20, 2025
25 checks passed
@Boy132 Boy132 deleted the boy132/clear-filament-cache-on-plugin-install branch December 20, 2025 01:00
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants