diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php index 5aba5bd09..4c79eb3a2 100644 --- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php +++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php @@ -52,11 +52,18 @@ public function instantSave() 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);