Repeater `saveRelationshipsUsing(null)` Not Hydrating Data Correctly

Repeater example:
Repeater::make('spot_types')
->relationship('spotTypes')
->saveRelationshipsUsing(null)
->dehydrated()
Repeater::make('spot_types')
->relationship('spotTypes')
->saveRelationshipsUsing(null)
->dehydrated()
Custom Action overriding handleRecordUpdate in the EditPage:
public function handle(array $data, Model $record): Model
{
$record->update($data);
$record->spotTypes()->sync($data['spot_types']);

return $record;
}
public function handle(array $data, Model $record): Model
{
$record->update($data);
$record->spotTypes()->sync($data['spot_types']);

return $record;
}
When I update a record using that custom Action, the record and its relationships are saved correctly in the database. However, after Filament's success notification, the Repeater displays old data. Refreshing the page shows the correct data. This issue only occurs with saveRelationshipsUsing(null). Is this a bug or expected? Is there a workaround?
1 Reply
toeknee
toeknee3w ago
I'd say do a new fresh instance of data and setting it? with form->fill
public function handle(array $data, Model $record): Model
{
$record->update($data);
$record->spotTypes()->sync($data['spot_types']);

$record = $record->fresh();
$this->form->fill($record);
return $record;
}
public function handle(array $data, Model $record): Model
{
$record->update($data);
$record->spotTypes()->sync($data['spot_types']);

$record = $record->fresh();
$this->form->fill($record);
return $record;
}

Did you find this page helpful?