Removed unused console.log and fixed takeSnapshot logic
This commit is contained in:
parent
61504d8702
commit
47885cd5f0
7 changed files with 8 additions and 16 deletions
|
|
@ -120,6 +120,9 @@ export default function ParameterComponent({
|
|||
const handleOnNewValue = (
|
||||
newValue: string | string[] | boolean | Object[]
|
||||
): void => {
|
||||
if (data.node!.template[name].value === newValue) {
|
||||
return;
|
||||
}
|
||||
takeSnapshot();
|
||||
data.node!.template[name].value = newValue;
|
||||
// Set state to pending
|
||||
|
|
|
|||
|
|
@ -134,7 +134,10 @@ export default function GenericNode({
|
|||
<NodeToolbarComponent
|
||||
position={{ x: xPos, y: yPos }}
|
||||
data={data}
|
||||
deleteNode={deleteNode}
|
||||
deleteNode={(id) => {
|
||||
takeSnapshot();
|
||||
deleteNode(id);
|
||||
}}
|
||||
setShowNode={(showNode: boolean) => {
|
||||
data.showNode = showNode;
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -337,7 +337,6 @@ export function FlowsProvider({ children }: { children: ReactNode }) {
|
|||
const currentfile = (e.target as HTMLInputElement).files![0];
|
||||
let text = await currentfile.text();
|
||||
let fileData: FlowType = await JSON.parse(text);
|
||||
console.log(isComponent, fileData);
|
||||
|
||||
if (
|
||||
(!fileData.is_component && isComponent === true) ||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import { APIKindType } from "../types/api";
|
|||
import { typesContextType } from "../types/typesContext";
|
||||
import { alertContext } from "./alertContext";
|
||||
import { AuthContext } from "./authContext";
|
||||
import { undoRedoContext } from "./undoRedoContext";
|
||||
|
||||
//context to share types adn functions from nodes to flow
|
||||
|
||||
|
|
@ -44,7 +43,6 @@ export function TypesProvider({ children }: { children: ReactNode }) {
|
|||
const [fetchError, setFetchError] = useState(false);
|
||||
const { setLoading } = useContext(alertContext);
|
||||
const { getAuthentication } = useContext(AuthContext);
|
||||
const { takeSnapshot } = useContext(undoRedoContext);
|
||||
const [getFilterEdge, setFilterEdge] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -100,7 +98,6 @@ export function TypesProvider({ children }: { children: ReactNode }) {
|
|||
}
|
||||
|
||||
function deleteNode(idx: string | Array<string>) {
|
||||
takeSnapshot();
|
||||
if (reactFlowInstance === null) return;
|
||||
const edges = reactFlowInstance!
|
||||
.getEdges()
|
||||
|
|
@ -116,7 +113,6 @@ export function TypesProvider({ children }: { children: ReactNode }) {
|
|||
});
|
||||
}
|
||||
function deleteEdge(idx: string | Array<string>) {
|
||||
takeSnapshot();
|
||||
reactFlowInstance!.deleteElements({
|
||||
edges:
|
||||
typeof idx === "string" ? [{ id: idx }] : idx.map((id) => ({ id })),
|
||||
|
|
|
|||
|
|
@ -71,7 +71,6 @@ export default function ShareModal({
|
|||
res?.results?.forEach((element: any) => {
|
||||
unavaliableNames.push(element.name);
|
||||
});
|
||||
console.log(unavaliableNames);
|
||||
setUnavaliableNames(unavaliableNames);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import ReactFlow, {
|
|||
EdgeChange,
|
||||
NodeChange,
|
||||
NodeDragHandler,
|
||||
OnEdgesDelete,
|
||||
OnSelectionChangeParams,
|
||||
SelectionDragHandler,
|
||||
addEdge,
|
||||
|
|
@ -124,6 +123,7 @@ export default function Page({
|
|||
lastSelection
|
||||
) {
|
||||
event.preventDefault();
|
||||
takeSnapshot();
|
||||
deleteNode(lastSelection.nodes.map((node) => node.id));
|
||||
deleteEdge(lastSelection.edges.map((edge) => edge.id));
|
||||
}
|
||||
|
|
@ -271,11 +271,6 @@ export default function Page({
|
|||
takeSnapshot();
|
||||
}, [takeSnapshot]);
|
||||
|
||||
const onEdgesDelete: OnEdgesDelete = useCallback(() => {
|
||||
// 👇 make deleting edges undoable
|
||||
takeSnapshot();
|
||||
}, [takeSnapshot]);
|
||||
|
||||
const onDragOver = useCallback((event: React.DragEvent) => {
|
||||
event.preventDefault();
|
||||
if (event.dataTransfer.types.some((types) => types === "nodedata")) {
|
||||
|
|
@ -461,7 +456,6 @@ export default function Page({
|
|||
onSelectionDragStart={onSelectionDragStart}
|
||||
onSelectionEnd={onSelectionEnd}
|
||||
onSelectionStart={onSelectionStart}
|
||||
onEdgesDelete={onEdgesDelete}
|
||||
connectionLineComponent={ConnectionLineComponent}
|
||||
onDragOver={onDragOver}
|
||||
onDrop={onDrop}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ export function getTagsIds(
|
|||
tags: string[],
|
||||
tagListId: { name: string; id: string }[]
|
||||
) {
|
||||
console.log(tags);
|
||||
console.log(tagListId);
|
||||
return tags
|
||||
.map((tag) => tagListId.find((tagObj) => tagObj.name === tag))!
|
||||
.map((tag) => tag!.id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue