From 3c799df887d99f5295cdbf903c2e5f7e7668445f Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Wed, 15 Oct 2025 22:20:52 +0200 Subject: [PATCH] fix: use wasChanged() instead of isDirty() in updated hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical Bug Fix: - isDirty() always returns false in the updated() hook - Changes are already persisted when updated() runs - wasChanged() correctly tracks what was modified during save Affected Code: - helper_version check: Now properly triggers PullHelperImageJob - fqdn check: Now properly clears TrustHosts cache Impact: ✅ Cache invalidation now works when FQDN changes ✅ Helper image updates now trigger correctly ✅ Security fix cache is properly cleared on config changes This also fixes an existing bug where helper_version updates never triggered the PullHelperImageJob dispatch. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/Models/InstanceSettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/InstanceSettings.php b/app/Models/InstanceSettings.php index 1251e146e..cd1c05de4 100644 --- a/app/Models/InstanceSettings.php +++ b/app/Models/InstanceSettings.php @@ -35,7 +35,7 @@ class InstanceSettings extends Model protected static function booted(): void { static::updated(function ($settings) { - if ($settings->isDirty('helper_version')) { + if ($settings->wasChanged('helper_version')) { Server::chunkById(100, function ($servers) { foreach ($servers as $server) { PullHelperImageJob::dispatch($server); @@ -44,7 +44,7 @@ protected static function booted(): void } // Clear trusted hosts cache when FQDN changes - if ($settings->isDirty('fqdn')) { + if ($settings->wasChanged('fqdn')) { \Cache::forget('instance_settings_fqdn_host'); } });