Change to income before saving, the recipient and paid off date is automatically null
\n
After saving the changes the recipient is filled with the previous recipient with the field is disabled
\n
The issue stems from relationship hydration taking precedence after save. Add afterStateHydrated to force null state: ->afterStateHydrated(function ($state, $set, $get) { if ($get('type') === TransactionType::income->value) { $set('recipient_id', null); } }). Alternatively, use ->saveRelationshipsUsing(fn($get) => $get('type') === TransactionType::income->value ? null : function() {}) as suggested in issue #17778. This is an open issue in Filament v4.
-
Beta Was this translation helpful? Give feedback.
-
|
The issue stems from relationship hydration taking precedence after save. Add |
Beta Was this translation helpful? Give feedback.
The issue stems from relationship hydration taking precedence after save. Add
afterStateHydratedto force null state:->afterStateHydrated(function ($state, $set, $get) { if ($get('type') === TransactionType::income->value) { $set('recipient_id', null); } }). Alternatively, use->saveRelationshipsUsing(fn($get) => $get('type') === TransactionType::income->value ? null : function() {})as suggested in issue #17778. This is an open issue in Filament v4.