From 6261c71e01d64e521111e2524403c3ed6e2b3be3 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Tue, 30 Apr 2024 15:11:26 -0300 Subject: [PATCH] Update InputGlobalComponent to handle unavaliableFields in useGlobalVariablesStore --- .../src/components/inputGlobalComponent/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/frontend/src/components/inputGlobalComponent/index.tsx b/src/frontend/src/components/inputGlobalComponent/index.tsx index 0d1b0ea40..6bd598778 100644 --- a/src/frontend/src/components/inputGlobalComponent/index.tsx +++ b/src/frontend/src/components/inputGlobalComponent/index.tsx @@ -23,6 +23,7 @@ export default function InputGlobalComponent({ ); const getVariableId = useGlobalVariablesStore((state) => state.getVariableId); + const unavaliableFields = useGlobalVariablesStore((state) => state.unavaliableFields); const removeGlobalVariable = useGlobalVariablesStore( (state) => state.removeGlobalVariable ); @@ -39,6 +40,15 @@ export default function InputGlobalComponent({ } }, [globalVariablesEntries]); + useEffect(() => { + if (!data.node?.template[name].value && data.node?.template[name].display_name) { + if(unavaliableFields[data.node?.template[name].display_name!]){ + setDb(true); + onChange(unavaliableFields[data.node?.template[name].display_name!]); + } + } + },[unavaliableFields]); + function handleDelete(key: string) { const id = getVariableId(key); if (id !== undefined) {