Merge branch 'bugFixes' into feature/store
This commit is contained in:
commit
9ae903150a
4 changed files with 14 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import { AxiosError } from "axios";
|
import { AxiosError } from "axios";
|
||||||
import _ from "lodash";
|
import _, { cloneDeep } from "lodash";
|
||||||
import {
|
import {
|
||||||
ReactNode,
|
ReactNode,
|
||||||
createContext,
|
createContext,
|
||||||
|
|
@ -458,6 +458,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
id: source,
|
id: source,
|
||||||
});
|
});
|
||||||
sourceHandleObject.id = source;
|
sourceHandleObject.id = source;
|
||||||
|
|
||||||
edge.data.sourceHandle = sourceHandleObject;
|
edge.data.sourceHandle = sourceHandleObject;
|
||||||
const targetHandleObject: targetHandleType = scapeJSONParse(
|
const targetHandleObject: targetHandleType = scapeJSONParse(
|
||||||
edge.targetHandle!
|
edge.targetHandle!
|
||||||
|
|
@ -482,6 +483,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
sourceHandle,
|
sourceHandle,
|
||||||
targetHandle,
|
targetHandle,
|
||||||
id,
|
id,
|
||||||
|
data: cloneDeep(edge.data),
|
||||||
style: { stroke: "#555" },
|
style: { stroke: "#555" },
|
||||||
className:
|
className:
|
||||||
targetHandleObject.type === "Text"
|
targetHandleObject.type === "Text"
|
||||||
|
|
@ -538,7 +540,8 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
let data = flow?.data ? flow.data : null;
|
let data = flow?.data ? flow.data : null;
|
||||||
if (data) {
|
if (data) {
|
||||||
processFlowEdges(flow);
|
processFlowEdges(flow);
|
||||||
processFlowNodes(flow);
|
//prevent node update for now
|
||||||
|
// processFlowNodes(flow);
|
||||||
//add animation to text type edges
|
//add animation to text type edges
|
||||||
updateEdges(data.edges);
|
updateEdges(data.edges);
|
||||||
// updateNodes(data.nodes, data.edges);
|
// updateNodes(data.nodes, data.edges);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import {
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
import { useUpdateNodeInternals } from "reactflow";
|
||||||
import ShadTooltip from "../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../components/ShadTooltipComponent";
|
||||||
import CodeAreaComponent from "../../components/codeAreaComponent";
|
import CodeAreaComponent from "../../components/codeAreaComponent";
|
||||||
import DictComponent from "../../components/dictComponent";
|
import DictComponent from "../../components/dictComponent";
|
||||||
|
|
@ -64,6 +65,7 @@ const EditNodeModal = forwardRef(
|
||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const [modalOpen, setModalOpen] = useState(open ?? false);
|
const [modalOpen, setModalOpen] = useState(open ?? false);
|
||||||
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
|
|
||||||
const myData = useRef(data);
|
const myData = useRef(data);
|
||||||
|
|
||||||
|
|
@ -83,11 +85,14 @@ const EditNodeModal = forwardRef(
|
||||||
const handleOnNewValue = (newValue: any, name) => {
|
const handleOnNewValue = (newValue: any, name) => {
|
||||||
myData.current.node!.template[name].value = newValue;
|
myData.current.node!.template[name].value = newValue;
|
||||||
setDataValue(newValue);
|
setDataValue(newValue);
|
||||||
|
updateNodeInternals(data.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
myData.current = data; // reset data to what it is on node when opening modal
|
if (modalOpen) {
|
||||||
onClose!(modalOpen);
|
myData.current = data; // reset data to what it is on node when opening modal
|
||||||
|
onClose!(modalOpen);
|
||||||
|
}
|
||||||
}, [modalOpen]);
|
}, [modalOpen]);
|
||||||
|
|
||||||
const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);
|
const [errorDuplicateKey, setErrorDuplicateKey] = useState(false);
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,6 @@ export default function Page({
|
||||||
event.dataTransfer.getData("nodedata")
|
event.dataTransfer.getData("nodedata")
|
||||||
);
|
);
|
||||||
|
|
||||||
// If data type is not "chatInput" or if there are no "chatInputNode" nodes present in the ReactFlow instance, create a new node
|
|
||||||
// Calculate the position where the node should be created
|
// Calculate the position where the node should be created
|
||||||
const position = reactFlowInstance!.project({
|
const position = reactFlowInstance!.project({
|
||||||
x: event.clientX - reactflowBounds!.left,
|
x: event.clientX - reactflowBounds!.left,
|
||||||
|
|
|
||||||
|
|
@ -1009,7 +1009,8 @@ export function expandGroupNode(
|
||||||
gNodes[nodeIndex].data.node!.template[field].show = show;
|
gNodes[nodeIndex].data.node!.template[field].show = show;
|
||||||
gNodes[nodeIndex].data.node!.template[field].advanced = advanced;
|
gNodes[nodeIndex].data.node!.template[field].advanced = advanced;
|
||||||
gNodes[nodeIndex].data.node!.template[field].display_name = display_name;
|
gNodes[nodeIndex].data.node!.template[field].display_name = display_name;
|
||||||
gNodes[nodeIndex].selected = false;
|
// keep the nodes selected after ungrouping
|
||||||
|
// gNodes[nodeIndex].selected = false;
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
gNodes[nodeIndex].data.node!.template[field].proxy = proxy;
|
gNodes[nodeIndex].data.node!.template[field].proxy = proxy;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue