From 7cd4263a1dc801aaeacdefc2b5c4ca4c1fc8bbe7 Mon Sep 17 00:00:00 2001 From: Benjamin Nussbaum Date: Wed, 11 Jun 2025 18:12:21 +0200 Subject: [PATCH] fix: browser refresh no longer needed after adding recipe --- .../views/livewire/plugins/index.blade.php | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/resources/views/livewire/plugins/index.blade.php b/resources/views/livewire/plugins/index.blade.php index c5daa74..d3db822 100644 --- a/resources/views/livewire/plugins/index.blade.php +++ b/resources/views/livewire/plugins/index.blade.php @@ -28,6 +28,20 @@ new class extends Component { 'polling_header' => 'nullable|string|max:255', ]; + private function refreshPlugins(): void + { + $userPlugins = auth()->user()?->plugins?->map(function ($plugin) { + return $plugin->toArray(); + })->toArray(); + + $this->plugins = array_merge($this->native_plugins, $userPlugins ?? []); + } + + public function mount(): void + { + $this->refreshPlugins(); + } + public function addPlugin(): void { abort_unless(auth()->user() !== null, 403); @@ -45,19 +59,11 @@ new class extends Component { ]); $this->reset(['name', 'data_stale_minutes', 'data_strategy', 'polling_url', 'polling_verb', 'polling_header']); + $this->refreshPlugins(); + Flux::modal('add-plugin')->close(); } - - public function mount(): void - { - $userPlugins = auth()->user()?->plugins?->map(function ($plugin) { - return $plugin->toArray(); - })->toArray(); - - $this->plugins = array_merge($this->native_plugins, $userPlugins ?? []); - } - public function seedExamplePlugins(): void { // \Artisan::call('db:seed', ['--class' => 'ExampleRecipesSeeder']);