Skip to content

Commit 1c565fd

Browse files
committed
refactor: Add lazy loading to tags in Livewire configuration view
1 parent 5778466 commit 1c565fd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

app/Livewire/Project/Shared/Tags.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ public function deleteTag(string $id)
8282
{
8383
try {
8484
$this->resource->tags()->detach($id);
85-
8685
$found_more_tags = Tag::ownedByCurrentTeam()->find($id);
87-
if ($found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) {
86+
if ($found_more_tags && $found_more_tags->applications()->count() == 0 && $found_more_tags->services()->count() == 0) {
8887
$found_more_tags->delete();
8988
}
9089
$this->refresh();
@@ -96,6 +95,7 @@ public function deleteTag(string $id)
9695

9796
public function refresh()
9897
{
98+
$this->resource->refresh(); // Remove this when legacy_model_binding is false
9999
$this->loadTags();
100100
$this->reset('newTags');
101101
}

resources/views/livewire/project/database/configuration.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<livewire:project.shared.metrics :resource="$database" />
100100
</div>
101101
<div x-cloak x-show="activeTab === 'tags'">
102-
<livewire:project.shared.tags :resource="$database" />
102+
<livewire:project.shared.tags :resource="$database" lazy />
103103
</div>
104104
<div x-cloak x-show="activeTab === 'danger'">
105105
<livewire:project.shared.danger :resource="$database" />

0 commit comments

Comments
 (0)