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.

fix: update success message logic to only show when changes are made

Andras Bacsaie4cc5c117836
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
index f867aaf3dc..12a4cae792 100644
--- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php
+++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
@@ -193,8 +193,8 @@ class All extends Component
}
}
- // Always show success message unless an error occurred
- if (! $errorOccurred) {
+ // Only show success message if changes were actually made and no errors occurred
+ if ($changesMade && ! $errorOccurred) {
$this->dispatch('success', 'Environment variables updated.');
}
}
diff --git a/tests/Feature/EnvironmentVariableCommentTest.php b/tests/Feature/EnvironmentVariableCommentTest.php
index 8b02ad8bf1..e7f9a07fb3 100644
--- a/tests/Feature/EnvironmentVariableCommentTest.php
+++ b/tests/Feature/EnvironmentVariableCommentTest.php
@@ -166,8 +166,8 @@ test('bulk update preserves existing comments when no inline comment provided',
'resource' => $this->application,
'type' => 'application',
])
- ->set('variablesInput', $bulkContent)
- ->call('saveVariables');
+ ->set('variables', $bulkContent)
+ ->call('submit');
// Refresh the environment variable
$env->refresh();
@@ -196,8 +196,8 @@ test('bulk update overwrites existing comments when inline comment provided', fu
'resource' => $this->application,
'type' => 'application',
])
- ->set('variablesInput', $bulkContent)
- ->call('saveVariables');
+ ->set('variables', $bulkContent)
+ ->call('submit');
// Refresh the environment variable
$env->refresh();
@@ -234,8 +234,8 @@ test('bulk update handles mixed inline and stored comments correctly', function
'resource' => $this->application,
'type' => 'application',
])
- ->set('variablesInput', $bulkContent)
- ->call('saveVariables');
+ ->set('variables', $bulkContent)
+ ->call('submit');
// Refresh both variables
$env1->refresh();
@@ -258,8 +258,8 @@ test('bulk update creates new variables with inline comments', function () {
'resource' => $this->application,
'type' => 'application',
])
- ->set('variablesInput', $bulkContent)
- ->call('saveVariables');
+ ->set('variables', $bulkContent)
+ ->call('submit');
// Check that variables were created with correct comments
$var1 = EnvironmentVariable::where('key', 'NEW_VAR1')