Skip to content

Commit ba400f3

Browse files
committed
#955 generic fix
1 parent cd1ea74 commit ba400f3

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/Neo.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@ function autoGenerateGetSet(proto, key) {
512512
// every set call has to delete the matching symbol
513513
delete me[configSymbol][key];
514514

515+
if (Array.isArray(value)) {
516+
if (key !== 'items') {
517+
value = [...value];
518+
}
519+
} else if (value instanceof Date) {
520+
value = new Date(value.valueOf());
521+
}
522+
515523
// we do want to store the value before the beforeSet modification as well,
516524
// since it could get pulled by other beforeSet methods of different configs
517525
me[_key] = value;

src/form/field/Text.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -490,12 +490,11 @@ class Text extends Base {
490490
value = [value];
491491
}
492492

493-
let me = this,
494-
newValue = [...value];
493+
let me = this;
495494

496-
newValue.forEach((item, index) => {
495+
value.forEach((item, index) => {
497496
if (item.isClass) {
498-
newValue[index] = Neo.create(item, {
497+
value[index] = Neo.create(item, {
499498
id : me.getTriggerId(item.prototype.type),
500499
field: me
501500
});
@@ -509,11 +508,11 @@ class Text extends Base {
509508
item.id = me.getTriggerId(item.module.prototype.type);
510509
}
511510

512-
newValue[index] = Neo[item.className ? 'create' : 'ntype']({...item, field: me});
511+
value[index] = Neo[item.className ? 'create' : 'ntype']({...item, field: me});
513512
}
514513
});
515514

516-
return newValue;
515+
return value;
517516
}
518517

519518
/**

0 commit comments

Comments
 (0)