🔨 refactor(formModal): remove unused keysValue state variable to improve code cleanliness and readability
🔨 refactor(formModal): update formKeysData type in tabsState to include handle_keys array for better data structure consistency and completeness
This commit is contained in:
parent
fce7b398f7
commit
ffebce974f
2 changed files with 9 additions and 8 deletions
|
|
@ -41,7 +41,6 @@ export default function FormModal({
|
|||
flow: FlowType;
|
||||
}) {
|
||||
const [chatValue, setChatValue] = useState("");
|
||||
const [keysValue, setKeysValue] = useState([]);
|
||||
const [chatHistory, setChatHistory] = useState<ChatMessageType[]>([]);
|
||||
const { reactFlowInstance } = useContext(typesContext);
|
||||
const { setErrorData, setNoticeData } = useContext(alertContext);
|
||||
|
|
@ -64,12 +63,6 @@ export default function FormModal({
|
|||
}, [open]);
|
||||
useEffect(() => {
|
||||
id.current = flow.id;
|
||||
|
||||
if (tabsState[flow.id].formKeysData) {
|
||||
setKeysValue(
|
||||
Array(tabsState[flow.id].formKeysData.input_keys.length).fill("")
|
||||
);
|
||||
}
|
||||
}, [flow.id, tabsState[flow.id], tabsState[flow.id].formKeysData]);
|
||||
|
||||
var isStream = false;
|
||||
|
|
@ -438,6 +431,14 @@ export default function FormModal({
|
|||
</div>
|
||||
</AccordionItem>
|
||||
))}
|
||||
{tabsState[id.current].formKeysData.handle_keys.map((i, k) => (
|
||||
<AccordionItem key={k} value={i}>
|
||||
<div className="flex flex-1 items-center justify-between py-4 font-normal transition-all group text-muted-foreground text-sm">
|
||||
<div className="group-hover:underline"><Badge size="md" variant="gray">{i}</Badge></div>
|
||||
Value coming from Handle
|
||||
</div>
|
||||
</AccordionItem>
|
||||
))}
|
||||
</Accordion>
|
||||
</div>
|
||||
<div className="w-full">
|
||||
|
|
|
|||
|
|
@ -33,6 +33,6 @@ export type TabsContextType = {
|
|||
export type TabsState = {
|
||||
[key: string]: {
|
||||
isPending: boolean;
|
||||
formKeysData: {input_keys?: Array<string>, memory_keys?: Array<string>};
|
||||
formKeysData: {input_keys?: Object, memory_keys?: Array<string>, handle_keys?: Array<string>};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue