Skip to content

Commit e31917d

Browse files
authored
fix list custom type serialization
1 parent ebee2b9 commit e31917d

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/serialization/sb3.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,19 @@ const makeSafeForJSON = (runtime, value) => {
625625
copy = value.slice();
626626
}
627627
const {serialize} = runtime.serializers[copy[i].customId];
628-
copy[i] = serialize(copy[i]);
628+
copy[i] = {
629+
customType: true,
630+
typeId: copy[i].customId,
631+
serialized: serialize(copy[i])
632+
};
633+
continue;
634+
}
635+
if (!isVariableValueSafeForJSON(value[i])) {
636+
if (!copy) {
637+
// Only copy the list when needed
638+
copy = value.slice();
639+
}
640+
copy[i] = `${copy[i]}`;
629641
}
630642
}
631643
if (copy) {

0 commit comments

Comments
 (0)