fix issue with string schema objects in repeaters

This commit is contained in:
Dan Harrin
2025-04-27 14:18:26 +01:00
parent f85302b2e5
commit d96eed96fd
2 changed files with 9 additions and 5 deletions
@@ -9,7 +9,7 @@ trait HasHelperText
{
public function helperText(string | Htmlable | Closure | null $text): static
{
$this->belowErrorMessage($text);
$this->belowContent($text);
return $this;
}
@@ -174,13 +174,17 @@ trait HasChildComponents
foreach ($this->childComponents as $key => $childComponents) {
if (is_array($childComponents)) {
$this->childComponents[$key] = array_map(
fn (Component | Action | ActionGroup $component): Component | Action | ActionGroup => match (true) {
$component instanceof Component => $component->getClone(),
default => clone $component,
fn (Component | Action | ActionGroup | string $component): Component | Action | ActionGroup | string => match (true) {
$component instanceof Component, $component instanceof Action, $component instanceof ActionGroup => $component->getClone(),
default => $component,
},
$childComponents,
);
} elseif (! ($childComponents instanceof Closure)) {
} elseif (
($childComponents instanceof Component) ||
($childComponents instanceof Action) ||
($childComponents instanceof ActionGroup)
) {
$this->childComponents[$key] = $childComponents->getClone();
}
}