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: Load environment variables based on resource type in sortEnvironmentVariables()

Andras Bacsai2227858f584c
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
index 5aba5bd095..4c79eb3a2f 100644
--- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php
+++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
@@ -52,11 +52,18 @@ class All extends Component
public function sortEnvironmentVariables()
{
- $this->resource->load(['environment_variables', 'environment_variables_preview']);
+ if ($this->resource->type() === 'application') {
+ $this->resource->load(['environment_variables', 'environment_variables_preview']);
+ } else {
+ $this->resource->load(['environment_variables']);
+ }
$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
$sortFunction = function ($variables) use ($sortBy) {
+ if (!$variables) {
+ return $variables;
+ }
if ($sortBy === 'key') {
return $variables->sortBy(function ($item) {
return strtolower($item->key);