refactor: Add lazy loading to tags in Livewire configuration view

This commit is contained in:
Andras Bacsai 2024-07-12 14:00:39 +02:00
parent 5778466947
commit 1c565fd502
2 changed files with 3 additions and 3 deletions

View File

@ -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');
}

View File

@ -99,7 +99,7 @@
<livewire:project.shared.metrics :resource="$database" />
</div>
<div x-cloak x-show="activeTab === 'tags'">
<livewire:project.shared.tags :resource="$database" />
<livewire:project.shared.tags :resource="$database" lazy />
</div>
<div x-cloak x-show="activeTab === 'danger'">
<livewire:project.shared.danger :resource="$database" />