Patiphan
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),
5 replies