Repeater visual bug after saving?

After saving repeater fields using a many-to-many relationship, I encounter a visual bug where all except one item within the same repeater disappear. However, everything reappears once I refresh the page.
Forms\Components\Repeater::make('Descriptions')
->label('Descriptions')
->relationship('descriptionProducts')
->simple(
Forms\Components\Select::make('description_id')
->label('Description')
->searchable()
->preload()
->debounce()
->required()
->options(
Models\Description::query()
->select('description', 'id')
->pluck('description', 'id'),
)
->allowHtml()
->createOptionForm([
Forms\Components\TextInput::make('description')
->label('Description')
->required(),
])
->createOptionUsing(function (array $data): int {
$description = Models\Description::query()->create($data);

return $description->id;
})
->disableOptionsWhenSelectedInSiblingRepeaterItems(),
)
->reorderable()
->defaultItems(0),
Forms\Components\Repeater::make('Descriptions')
->label('Descriptions')
->relationship('descriptionProducts')
->simple(
Forms\Components\Select::make('description_id')
->label('Description')
->searchable()
->preload()
->debounce()
->required()
->options(
Models\Description::query()
->select('description', 'id')
->pluck('description', 'id'),
)
->allowHtml()
->createOptionForm([
Forms\Components\TextInput::make('description')
->label('Description')
->required(),
])
->createOptionUsing(function (array $data): int {
$description = Models\Description::query()->create($data);

return $description->id;
})
->disableOptionsWhenSelectedInSiblingRepeaterItems(),
)
->reorderable()
->defaultItems(0),
2 Replies
toeknee
toeknee2mo ago
Did it save correctly but only reloads the last item in?
Patiphan
PatiphanOP2mo ago
Yes, after saving it only loads the last item in, looks like it overwrites the last index every time. It has been saved correctly as shown in the video

Did you find this page helpful?