update: make types for nodes and edges a computed prop

* remove nodeTypesId (was used in react to manually trigger a nodeTypes change)

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-20 03:28:46 +01:00
parent 2b87d53c10
commit 1b6ea1e1b5
4 changed files with 21 additions and 16 deletions
+8 -5
View File
@@ -15,11 +15,14 @@ const props = withDefaults(defineProps<EdgeProps>(), {})
const store = useStore()
const edgeType = props.edge.type || 'default'
const type = store.getEdgeTypes[edgeType] || store.getEdgeTypes.default
if (!store.getEdgeTypes[edgeType]) {
console.warn(`Edge type "${edgeType}" not found. Using fallback type "default".`)
}
const type = computed(() => {
const edgeType = props.edge.type || 'default'
const t = store.getEdgeTypes[edgeType] || store.getEdgeTypes.default
if (!store.getEdgeTypes[edgeType]) {
console.warn(`Edge type "${edgeType}" not found. Using fallback type "default".`)
}
return t
})
const updating = ref<boolean>(false)
const onEdgeClick = (event: MouseEvent) => {