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

This commit is contained in:
Andras Bacsai
2025-11-25 10:11:48 +01:00
parent 61dcf8b4ac
commit e4cc5c1178
2 changed files with 10 additions and 10 deletions
@@ -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.');
}
}
@@ -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')