Skip to content

Commit 4157399

Browse files
authored
Hotfix for edit transaction form not working due to incorrect uuid generation. (#87)
1 parent e961e2a commit 4157399

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/components/form/input/ComplexTypeInput.js

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import { mdiDelete, mdiTablePlus } from "@mdi/js";
55
import { FormContext } from "../Form";
66
import {Button} from "../../layout/button";
77
import Translation from "../../localization/translation.component";
8-
9-
function createUUID() {
10-
return crypto.randomUUID()
11-
}
8+
import { Resolver } from "../../../core";
129

1310
export class ComplexTypeInput extends React.Component {
1411
static contextType = FormContext
@@ -28,13 +25,15 @@ export class ComplexTypeInput extends React.Component {
2825

2926
registerField() {
3027
this.context.addField({
31-
field: this.props,
32-
value: this.props.value?.map(el => {
33-
return {
34-
...el,
35-
_uuid: createUUID()
36-
}
37-
})
28+
field: {
29+
...this.props,
30+
value: this.props.value?.map(el => {
31+
return {
32+
...el,
33+
_uuid: Resolver.uuid(),
34+
}
35+
})
36+
}
3837
})
3938
}
4039

@@ -59,7 +58,7 @@ export class ComplexTypeInput extends React.Component {
5958
const field = this.context.fields[id] || { value: [] };
6059

6160
field.value.push({
62-
_uuid: createUUID(),
61+
_uuid: Resolver.uuid(),
6362
...blankEntity })
6463

6564
this.onChange(field.value)

0 commit comments

Comments
 (0)