Fix data not updating when component mounts
This commit is contained in:
parent
5e73b0b9ab
commit
edb1e4137f
1 changed files with 4 additions and 4 deletions
|
|
@ -134,14 +134,14 @@ export default function ParameterComponent({
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
function fetchData() {
|
function fetchData() {
|
||||||
if (data.node?.template[name]?.refresh) {
|
if (
|
||||||
|
data.node?.template[name]?.refresh &&
|
||||||
|
Object.keys(data.node?.template[name]?.options ?? {}).length === 0
|
||||||
|
) {
|
||||||
handleUpdateValues(name, data, false);
|
handleUpdateValues(name, data, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fetchData();
|
fetchData();
|
||||||
// I want this to run as soon as the component mounts
|
|
||||||
// but it is not updating the data
|
|
||||||
// the .refresh does not change
|
|
||||||
}, []);
|
}, []);
|
||||||
const handleOnNewValue = (
|
const handleOnNewValue = (
|
||||||
newValue: string | string[] | boolean | Object[]
|
newValue: string | string[] | boolean | Object[]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue