vue-flow: Can't create new edge (js)

Hi! At first thanks for your work! Can’t understand what I’m doing wrong…

    const onConnect = (params) => {
      console.log("on connect", params);
      elements.value = addEdge(params, elements.value);
    };

and the console output is:

source: "3"​
sourceHandle: null​
target: "4"​
targetHandle: ""

Uncaught TypeError: t is undefined

my custom node:

<template>
  <Handle
    type="target"
    :position="Position.Left"
    :style="{
      background: '#fff',
      border: '1px solid',
      'border-color': getCssVar('warning'),
      width: '10px',
      height: '10px',
    }"
  />
  <q-card>
    <q-card-section class="bg-warning text-white text-h6">
      {{ node.label }}
    </q-card-section>
    <q-card-section>
      <q-input label="Sec" outlined="" v-model="node.value" />
    </q-card-section>
  </q-card>
  <Handle
    type="source"
    :position="Position.Right"
    :style="{
      background: '#fff',
      border: '1px solid',
      'border-color': getCssVar('warning'),
      width: '10px',
      height: '10px',
    }"
  />
</template>

<script>
import { defineComponent, ref } from "vue";
import { Handle, Position } from "@braks/vue-flow";

import { getCssVar } from "quasar";

export default defineComponent({
  name: "MessageNode",
  components: {
    Handle,
  },
  props: ["data"],
  setup(props) {
    const node = ref(props.data);
    return {
      getCssVar,
      Position,
      node,
    };
  },
});
</script>

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

Ahh, now I see what you mean. Yeah that should obviously be prevented, good catch, thanks 😄 I will fix that asap.

The second part of your question I don’t understand, You have to explain that a little more detailed because I can’t follow what’s wrong confused You create an edge and it handles a doubleclick when it shouldn’t?

follow your link and doubleclick one of the handles on DelayNode for example. You will see an edge created between DelayNode handles

  1. Create edge by clicking handles of both nodes
  2. Select edge by mouse click. Backspace
  3. Do first step again. Have an error src.zip It’s just test project for vue-flows, so nothing more here. UPD. If you do same steps once more you’ll be able to see the new edge that going through source node 😄