From 1c565fd50215de836fb1aa7d6ad872655941ba18 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 12 Jul 2024 14:00:39 +0200 Subject: [PATCH] refactor: Add lazy loading to tags in Livewire configuration view --- app/Livewire/Project/Shared/Tags.php | 4 ++-- .../views/livewire/project/database/configuration.blade.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Livewire/Project/Shared/Tags.php b/app/Livewire/Project/Shared/Tags.php index 42c56d3a1..dca6180ff 100644 --- a/app/Livewire/Project/Shared/Tags.php +++ b/app/Livewire/Project/Shared/Tags.php @@ -82,9 +82,8 @@ public function deleteTag(string $id) { try { $this->resource->tags()->detach($id); - $found_more_tags = Tag::ownedByCurrentTeam()->find($id); - if ($found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) { + if ($found_more_tags && $found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) { $found_more_tags->delete(); } $this->refresh(); @@ -96,6 +95,7 @@ public function deleteTag(string $id) public function refresh() { + $this->resource->refresh(); // Remove this when legacy_model_binding is false $this->loadTags(); $this->reset('newTags'); } diff --git a/resources/views/livewire/project/database/configuration.blade.php b/resources/views/livewire/project/database/configuration.blade.php index aa5b8ec5e..652aec3eb 100644 --- a/resources/views/livewire/project/database/configuration.blade.php +++ b/resources/views/livewire/project/database/configuration.blade.php @@ -99,7 +99,7 @@
- +