✨ (inputGlobalComponent/index.tsx): add useEffect hook to handle unavailable fields in the input component
🐛 (inputGlobalComponent/index.tsx): fix typo in the variable name 'unavailableFields'
This commit is contained in:
commit
edc0d79c28
1 changed files with 15 additions and 0 deletions
|
|
@ -23,6 +23,9 @@ export default function InputGlobalComponent({
|
||||||
);
|
);
|
||||||
|
|
||||||
const getVariableId = useGlobalVariablesStore((state) => state.getVariableId);
|
const getVariableId = useGlobalVariablesStore((state) => state.getVariableId);
|
||||||
|
const unavaliableFields = useGlobalVariablesStore(
|
||||||
|
(state) => state.unavaliableFields
|
||||||
|
);
|
||||||
const removeGlobalVariable = useGlobalVariablesStore(
|
const removeGlobalVariable = useGlobalVariablesStore(
|
||||||
(state) => state.removeGlobalVariable
|
(state) => state.removeGlobalVariable
|
||||||
);
|
);
|
||||||
|
|
@ -39,6 +42,18 @@ export default function InputGlobalComponent({
|
||||||
}
|
}
|
||||||
}, [globalVariablesEntries]);
|
}, [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]);
|
||||||
|
|
||||||
async function handleDelete(key: string) {
|
async function handleDelete(key: string) {
|
||||||
const id = getVariableId(key);
|
const id = getVariableId(key);
|
||||||
if (id !== undefined) {
|
if (id !== undefined) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue