fix(parameterComponent): import cloneDeep from lodash to fix missing import error
feat(parameterComponent): add support for process.env.PORT environment variable to be able to run app on a configurable port fix(PageComponent): add conditional logic to fit the view based on the number of nodes in the flow
This commit is contained in:
parent
90621f509b
commit
c8c899d1ad
2 changed files with 19 additions and 14 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { cloneDeep } from "lodash";
|
||||||
import React, {
|
import React, {
|
||||||
ReactNode,
|
ReactNode,
|
||||||
useContext,
|
useContext,
|
||||||
|
|
@ -68,7 +69,7 @@ export default function ParameterComponent({
|
||||||
const { setErrorData } = useContext(alertContext);
|
const { setErrorData } = useContext(alertContext);
|
||||||
const updateNodeInternals = useUpdateNodeInternals();
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
const [position, setPosition] = useState(0);
|
const [position, setPosition] = useState(0);
|
||||||
const { setTabsState, tabId, flows } = useContext(FlowsContext);
|
const { setTabsState, tabId, flows, tabsState } = useContext(FlowsContext);
|
||||||
|
|
||||||
const flow = flows.find((flow) => flow.id === tabId)?.data?.nodes ?? null;
|
const flow = flows.find((flow) => flow.id === tabId)?.data?.nodes ?? null;
|
||||||
|
|
||||||
|
|
@ -126,19 +127,14 @@ export default function ParameterComponent({
|
||||||
data.node!.template[name].value = newValue;
|
data.node!.template[name].value = newValue;
|
||||||
// Set state to pending
|
// Set state to pending
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
setTabsState((prev: TabsState) => {
|
if (data.node!.template[name].value !== newValue) {
|
||||||
if (!prev[tabId]) {
|
const tabs = cloneDeep(tabsState);
|
||||||
return prev;
|
tabs[tabId].isPending = false;
|
||||||
}
|
tabs[tabId].formKeysData = tabsState[tabId].formKeysData;
|
||||||
return {
|
setTabsState({
|
||||||
...prev,
|
...tabs,
|
||||||
[tabId]: {
|
});
|
||||||
...prev[tabId],
|
}
|
||||||
isPending: true,
|
|
||||||
formKeysData: prev[tabId].formKeysData,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
});
|
|
||||||
renderTooltips();
|
renderTooltips();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,15 @@ export default function Page({
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
//remove this if you dont want to see the whole flow on fork
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
flow?.data!.nodes!.length > 3
|
||||||
|
? reactFlowInstance?.fitView({ padding: 0.1 })
|
||||||
|
: reactFlowInstance?.fitView({ padding: 0.5 });
|
||||||
|
}, 200);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const onEdgesChangeMod = useCallback(
|
const onEdgesChangeMod = useCallback(
|
||||||
(change: EdgeChange[]) => {
|
(change: EdgeChange[]) => {
|
||||||
updateFlow({
|
updateFlow({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue