more useeffect dependencies fixed
This commit is contained in:
parent
2be08ff3e5
commit
bc0cb9685c
2 changed files with 26 additions and 27 deletions
|
|
@ -30,7 +30,7 @@ export default function Chat({flow, reactFlowInstance }:ChatType) {
|
|||
};
|
||||
useEffect(()=>{
|
||||
updateFlow({..._.cloneDeep(flow),chat:chatHistory})
|
||||
},[saveChat])
|
||||
},[chatHistory, flow, saveChat, updateFlow])
|
||||
useEffect(()=>{
|
||||
setChatHistory(flow.chat)
|
||||
},[flow])
|
||||
|
|
|
|||
|
|
@ -14,34 +14,33 @@ export default function ExtraSidebar() {
|
|||
const [data, setData] = useState({});
|
||||
const { setTypes} = useContext(typesContext);
|
||||
|
||||
async function getTypes():Promise<void>{
|
||||
const initialValue:{[char: string]: string} = {
|
||||
str: "advanced",
|
||||
bool: "advanced",
|
||||
chatOutput: "chat",
|
||||
chatInput: "chat",
|
||||
}
|
||||
let result = await getAll();
|
||||
setData(result.data);
|
||||
setTypes(
|
||||
Object.keys(result.data).reduce(
|
||||
(acc, curr) => {
|
||||
Object.keys(result.data[curr]).forEach((c:keyof APIKindType) => {
|
||||
acc[c] = curr;
|
||||
result.data[curr][c].base_classes?.forEach((b) => {
|
||||
acc[b] = curr;
|
||||
});
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
initialValue
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
async function getTypes():Promise<void>{
|
||||
const initialValue:{[char: string]: string} = {
|
||||
str: "advanced",
|
||||
bool: "advanced",
|
||||
chatOutput: "chat",
|
||||
chatInput: "chat",
|
||||
}
|
||||
let result = await getAll();
|
||||
setData(result.data);
|
||||
setTypes(
|
||||
Object.keys(result.data).reduce(
|
||||
(acc, curr) => {
|
||||
Object.keys(result.data[curr]).forEach((c:keyof APIKindType) => {
|
||||
acc[c] = curr;
|
||||
result.data[curr][c].base_classes?.forEach((b) => {
|
||||
acc[b] = curr;
|
||||
});
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
initialValue
|
||||
)
|
||||
);
|
||||
}
|
||||
getTypes();
|
||||
}, []);
|
||||
}, [setTypes]);
|
||||
|
||||
|
||||
function onDragStart(event: React.DragEvent<any>, data:{type:string,node?:APIClassType}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue