Fix flows being called unnecessarily
This commit is contained in:
parent
93ec12beb7
commit
bd243d9f80
2 changed files with 7 additions and 9 deletions
|
|
@ -103,7 +103,7 @@ function BaseModal({
|
|||
break;
|
||||
case "smaller":
|
||||
minWidth = "min-w-[40vw]";
|
||||
height = "h-[27vh]";
|
||||
height = "h-[11rem]";
|
||||
break;
|
||||
case "smaller-h-full":
|
||||
minWidth = "min-w-[40vw]";
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import IconComponent from "../../components/genericIconComponent";
|
|||
import { Button } from "../../components/ui/button";
|
||||
import { SETTINGS_DIALOG_SUBTITLE } from "../../constants/constants";
|
||||
import { FlowsContext } from "../../contexts/flowsContext";
|
||||
import { readFlowsFromDatabase } from "../../controllers/API";
|
||||
import { FlowSettingsPropsType } from "../../types/components";
|
||||
import { FlowType } from "../../types/flow";
|
||||
import BaseModal from "../baseModal";
|
||||
|
|
@ -13,7 +12,7 @@ export default function FlowSettingsModal({
|
|||
open,
|
||||
setOpen,
|
||||
}: FlowSettingsPropsType): JSX.Element {
|
||||
const { flows, tabId, updateFlow, saveFlow } = useContext(FlowsContext);
|
||||
const { flows, tabId, saveFlow } = useContext(FlowsContext);
|
||||
const flow = flows.find((f) => f.id === tabId);
|
||||
useEffect(() => {
|
||||
setName(flow!.name);
|
||||
|
|
@ -31,15 +30,14 @@ export default function FlowSettingsModal({
|
|||
}
|
||||
|
||||
const [nameLists, setNameList] = useState<string[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const tempNameList: string[] = [];
|
||||
readFlowsFromDatabase().then((flows) => {
|
||||
flows.forEach((flow: FlowType) => {
|
||||
tempNameList.push(flow.name);
|
||||
});
|
||||
setNameList(tempNameList.filter((name) => name !== flow!.name));
|
||||
flows.forEach((flow: FlowType) => {
|
||||
tempNameList.push(flow.name);
|
||||
});
|
||||
}, []);
|
||||
setNameList(tempNameList.filter((name) => name !== flow!.name));
|
||||
}, [flows]);
|
||||
|
||||
return (
|
||||
<BaseModal open={open} setOpen={setOpen} size="smaller">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue