fix(edges): Handles emitting connect and update simulteanously
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import { Position } from '../../types'
|
|||||||
import { NodeId } from '../../context'
|
import { NodeId } from '../../context'
|
||||||
import type { HandleProps } from '../../types/components'
|
import type { HandleProps } from '../../types/components'
|
||||||
|
|
||||||
const { id } = useVueFlow()
|
const { id, hooks } = useVueFlow()
|
||||||
const props = withDefaults(defineProps<HandleProps>(), {
|
const props = withDefaults(defineProps<HandleProps>(), {
|
||||||
id: '',
|
id: '',
|
||||||
type: 'source',
|
type: 'source',
|
||||||
@@ -16,7 +16,9 @@ const nodeId = inject(NodeId, '')
|
|||||||
|
|
||||||
const handler = useHandle()
|
const handler = useHandle()
|
||||||
const onMouseDownHandler = (event: MouseEvent) =>
|
const onMouseDownHandler = (event: MouseEvent) =>
|
||||||
handler(event, props.id, nodeId, props.type === 'target', props.isValidConnection)
|
handler(event, props.id, nodeId, props.type === 'target', props.isValidConnection, undefined, (connection) =>
|
||||||
|
hooks.value.connect.trigger(connection),
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -149,7 +149,6 @@ export default (store: FlowStore = useVueFlow().store) =>
|
|||||||
const isOwnHandle = connection.source === connection.target
|
const isOwnHandle = connection.source === connection.target
|
||||||
|
|
||||||
if (isValid && !isOwnHandle) {
|
if (isValid && !isOwnHandle) {
|
||||||
store.hooks.connect.trigger(connection)
|
|
||||||
onEdgeUpdate?.(connection)
|
onEdgeUpdate?.(connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user