🐛 fix(ApiModal/index.tsx): fix bug where tweak.current was not being properly reset when getTweak, tweak.current, and flow["data"]["nodes"] were all empty
✨ feat(ApiModal/index.tsx): add useEffect dependency on flow["data"]["nodes"] to trigger filterNodes function when nodes data changes
This commit is contained in:
parent
e74f3c9dd5
commit
ee4c465aba
1 changed files with 12 additions and 6 deletions
|
|
@ -112,13 +112,19 @@ const ApiModal = forwardRef(
|
||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
||||||
filterNodes();
|
|
||||||
|
|
||||||
if(getTweak.length == 0){
|
if(getTweak.length == 0 && tweak?.current.length == 0 && flow["data"]["nodes"].length == 0){
|
||||||
const t = buildTweaks(flow);
|
tweak.current = [];
|
||||||
tweak?.current?.push(t);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
tweak.current = [];
|
||||||
|
const t = buildTweaks(flow);
|
||||||
|
tweak.current.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
filterNodes();
|
||||||
|
|
||||||
if (Object.keys(tweaksCode).length > 0) {
|
if (Object.keys(tweaksCode).length > 0) {
|
||||||
tabs.push({
|
tabs.push({
|
||||||
name: "Tweaks",
|
name: "Tweaks",
|
||||||
|
|
@ -128,7 +134,7 @@ const ApiModal = forwardRef(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}, [closePopUp]);
|
}, [flow["data"]["nodes"]]);
|
||||||
|
|
||||||
|
|
||||||
function filterNodes() {
|
function filterNodes() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue