You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the Repeater field seems to regenerate the repeater element UUIDs every time the state is hydrated:
protectedfunctionsetUp(): void
{
...foreach ($state ?? [] as$itemData) {
if ($simpleField) {
$itemData = [$simpleField->getName() => $itemData];
}
// This generates a new UUID here even if the original `$state` array had a valid one that could have been re-usedif ($uuid = $component->generateUuid()) {
$items[$uuid] = $itemData;
} else {
$items[] = $itemData;
}
}
...
}
This is kind of annoying if you ever want to rely on that UUID being constant for a specific repeater item. Within $state here the repeater may already have a valid UUID, does it need to generate a new one?
Possibly we could do something like this? Allowing the existing UUID to be reused if desired (and by default leave current behaviour).
foreach ($state ?? [] as$key => $itemData) {
if ($simpleField) {
$itemData = [$simpleField->getName() => $itemData];
}
// Pass in the existing key and let `CanGenerateUuids` decide whether it needs regeneratingif ($uuid = $component->generateUuid($key)) {
$items[$uuid] = $itemData;
} else {
$items[] = $itemData;
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently the
Repeater
field seems to regenerate the repeater element UUIDs every time the state is hydrated:This is kind of annoying if you ever want to rely on that UUID being constant for a specific repeater item. Within
$state
here the repeater may already have a valid UUID, does it need to generate a new one?Possibly we could do something like this? Allowing the existing UUID to be reused if desired (and by default leave current behaviour).
Beta Was this translation helpful? Give feedback.
All reactions