Skip to content

Commit 6b33123

Browse files
authored
fix add form error when form key does not exist (#212)
* fix add form error when form key does not exist
1 parent 93c6c02 commit 6b33123

3 files changed

Lines changed: 382 additions & 15 deletions

File tree

src/components/Dialogs/AddFormDialog.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,12 @@
1010
*
1111
* SPDX-License-Identifier: EPL-2.0 OR W3C-20150513
1212
********************************************************************************/
13-
import React, {
14-
forwardRef,
15-
useContext,
16-
useState,
17-
useImperativeHandle,
18-
} from "react";
13+
import { forwardRef, useContext, useState, useImperativeHandle } from "react";
1914
import ReactDOM from "react-dom";
2015
import ediTDorContext from "../../context/ediTDorContext";
2116
import { checkIfFormIsInItem } from "../../utils/tdOperations";
2217
import DialogTemplate from "./DialogTemplate";
2318
import AddForm from "../App/AddForm";
24-
import FormCheckbox from "../base/FormCheckbox";
25-
import { HardDrive } from "react-feather";
26-
import { set } from "lodash";
2719

2820
export type OperationsType = "property" | "action" | "event" | "thing" | "";
2921
export type OperationsMap = PropertyMap | ActionMap | EventMap | ThingMap;
@@ -122,7 +114,7 @@ const AddFormDialog = forwardRef<AddFormDialogRef, AddFormDialogProps>(
122114
const checkDuplicates = (form: ExplicitForm): boolean => {
123115
const isDuplicate: boolean =
124116
interaction.forms !== undefined
125-
? checkIfFormIsInItem(form, interaction)
117+
? checkIfFormIsInItem(form, interaction as { forms: ExplicitForm[] })
126118
: false;
127119
return isDuplicate;
128120
};

0 commit comments

Comments
 (0)