Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Add lazy loading to tags in Livewire configuration view

Andras Bacsai1c565fd50215
diff --git a/app/Livewire/Project/Shared/Tags.php b/app/Livewire/Project/Shared/Tags.php
index 42c56d3a18..dca6180ff6 100644
--- a/app/Livewire/Project/Shared/Tags.php
+++ b/app/Livewire/Project/Shared/Tags.php
@@ -82,9 +82,8 @@ class Tags extends Component
{
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 @@ class Tags extends Component
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 aa5b8ec5e1..652aec3eb0 100644
--- a/resources/views/livewire/project/database/configuration.blade.php
+++ b/resources/views/livewire/project/database/configuration.blade.php
@@ -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" />