delete logic changed to work even after page refresh
This commit is contained in:
parent
94577a383c
commit
2988821828
6 changed files with 16 additions and 39 deletions
|
|
@ -8,7 +8,7 @@ import { typesContext } from "../../contexts/typesContext";
|
|||
|
||||
export default function BooleanNode({ data }) {
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
const {types} = useContext(typesContext);
|
||||
const {types, deleteNode} = useContext(typesContext);
|
||||
return (
|
||||
<div className="prompt-node relative bg-white rounded-lg solid border flex flex-col justify-center">
|
||||
<div className="w-full flex items-center justify-between gap-8 p-4 bg-gray-50 border-b ">
|
||||
|
|
@ -21,7 +21,7 @@ export default function BooleanNode({ data }) {
|
|||
</div>
|
||||
<button
|
||||
onClick={() => {
|
||||
data.onDelete(data);
|
||||
deleteNode(data.id);
|
||||
}}
|
||||
>
|
||||
<TrashIcon className="text-gray-600 w-6 h-6 hover:text-red-500"></TrashIcon>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ import { typesContext } from "../../contexts/typesContext";
|
|||
import { useContext } from "react";
|
||||
|
||||
export default function GenericNode({ data }) {
|
||||
const {types} = useContext(typesContext);
|
||||
console.log(types, data.type)
|
||||
const {types, deleteNode} = useContext(typesContext);
|
||||
const Icon = nodeIcons[types[data.type]];
|
||||
|
||||
|
||||
|
|
@ -26,7 +25,7 @@ export default function GenericNode({ data }) {
|
|||
/>
|
||||
<div className="truncate">{data.type}</div>
|
||||
</div>
|
||||
<button onClick={data.onDelete}>
|
||||
<button onClick={() => {deleteNode(data.id)}}>
|
||||
<TrashIcon className="w-6 h-6 hover:text-red-500"></TrashIcon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import Tooltip from "../../components/TooltipComponent";
|
|||
import { typesContext } from "../../contexts/typesContext";
|
||||
|
||||
export default function InputNode({ data }) {
|
||||
const {types} = useContext(typesContext);
|
||||
const {types, deleteNode} = useContext(typesContext);
|
||||
return (
|
||||
<div className="prompt-node relative bg-white w-96 rounded-lg solid border flex flex-col justify-center">
|
||||
<Tooltip title="Prefix: str">
|
||||
|
|
@ -38,7 +38,7 @@ export default function InputNode({ data }) {
|
|||
</div>
|
||||
<button
|
||||
onClick={() => {
|
||||
data.onDelete(data);
|
||||
deleteNode(data.id)
|
||||
}}
|
||||
>
|
||||
<TrashIcon className="text-gray-600 w-6 h-6 hover:text-red-500"></TrashIcon>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue