[FIX] Field Groups hydration

This commit is contained in:
2026-01-24 18:02:08 +02:00
parent 9af93b2073
commit 41da78263b

View File

@@ -145,7 +145,7 @@ class AstromicFormController {
final def = _groupDefs[groupId]; final def = _groupDefs[groupId];
if (def == null) throw Exception('Group $groupId not registered.'); if (def == null) throw Exception('Group $groupId not registered.');
final newUuid = DateTime.now().microsecondsSinceEpoch.toString(); final newUuid = '${DateTime.now().microsecondsSinceEpoch}_${_nodes.length}';
def.schema.forEach((fieldName, config) { def.schema.forEach((fieldName, config) {
final nodeKey = '${groupId}_${fieldName}_$newUuid'; final nodeKey = '${groupId}_${fieldName}_$newUuid';
@@ -174,6 +174,9 @@ class AstromicFormController {
} }
void _createTypedNode<T>(String key, AstromicFieldConfig<T> config, T initialValue) { void _createTypedNode<T>(String key, AstromicFieldConfig<T> config, T initialValue) {
// FORCE clear if it somehow exists (prevents ghosting)
_nodes.remove(key);
_nodes[key] = AstromicFieldNode<T>( _nodes[key] = AstromicFieldNode<T>(
initialValue, initialValue,
formatter: config.formatter ?? (v) => v.toString(), formatter: config.formatter ?? (v) => v.toString(),