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