Skip to content

Commit d7d2b6f

Browse files
committed
fix(editor2): incorrect behavior on entity creation
1 parent 104f238 commit d7d2b6f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/components/editor2/reconciliation.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type WithId<T = {}> = T extends never ? never : T & { id: string }
3939
export function createAction(
4040
initialValues: SetRequired<Partial<Omit<EditorAction, 'id'>>, 'type'>,
4141
) {
42-
const action: EditorAction = defaults({}, initialValues, { id: uniqueId() })
42+
const action: EditorAction = defaults({ id: uniqueId() }, initialValues)
4343
if (action.type === CopilotDocV1.Type.SkillUsage) {
4444
action.skillUsage = CopilotDocV1.SkillUsageType.ReadyToUse
4545
}
@@ -49,18 +49,17 @@ export function createAction(
4949
export function createGroup(
5050
initialValues: Partial<Omit<EditorGroup, 'id' | 'opers'>> = {},
5151
): EditorGroup {
52-
const group: EditorGroup = defaults({ name: '', opers: [] }, initialValues, {
53-
id: uniqueId(),
52+
const group: EditorGroup = defaults({ id: uniqueId() }, initialValues, {
53+
name: '',
54+
opers: [],
5455
})
5556
return group
5657
}
5758

5859
export function createOperator(
5960
initialValues: Omit<EditorOperator, 'id'>,
6061
): EditorOperator {
61-
const operator: EditorOperator = defaults({ skill: 1 }, initialValues, {
62-
id: uniqueId(),
63-
})
62+
const operator: EditorOperator = defaults({ id: uniqueId() }, initialValues)
6463
return operator
6564
}
6665

0 commit comments

Comments
 (0)