Skip to content

Prevent nodes from being removed #275

Answered by bcakmakoglu
rubenduiveman asked this question in Q&A
Discussion options

You must be logged in to vote

I see, that could be added at some point.
For now you can hook into the apply changes process and stop the deletion of nodes if necessary.

<script setup>
const { applyNodeChanges, onNodesChange } = useVueFlow()

onNodesChange((changes) => {
	const nextChanges = changes.filter((change) => {
		if (change.type === 'remove') {
			// block removing
		}
	})

	applyNodeChanges(nextChanges)
}) 
</script>

<template>
	<div style="height: 300px">
		<VueFlow :apply-default="false" />
	</div>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rubenduiveman
Comment options

Answer selected by bcakmakoglu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants