Removed empty dependency loop errors

This commit is contained in:
Stefan Zermatten
2022-07-26 14:09:51 +02:00
parent 1050442606
commit 0bb96e8469
3 changed files with 12 additions and 16 deletions

View File

@@ -56,12 +56,14 @@ function pushDependenciesToStack(nodeId, graph, stack, computation){
oriented: true
});
const loop = pather.find(nodeId, nodeId);
computation.errors.push({
type: 'dependencyLoop',
details: {
nodes: loop.map(node => node.id)
},
});
if (loop.length) {
computation.errors.push({
type: 'dependencyLoop',
details: {
nodes: loop.map(node => node.id)
},
});
}
}
stack.push(linkedNode);
}, true);

View File

@@ -1,5 +1,5 @@
<template>
<div v-if="creature && creature.computeErrors">
<div v-if="creature && errors && errors.length">
<v-btn
fab
small
@@ -28,7 +28,7 @@
v-if="expanded"
class="character-sheet-errors"
>
<template v-for="(error, index) in creature.computeErrors">
<template v-for="(error, index) in errors">
<dependency-loop-error
v-if="error.type === 'dependencyLoop'"
:key="index + 'dependencyLoopError'"
@@ -84,13 +84,8 @@ export default {
},
computed: {
errors() {
if (!this.creature || !this.creature.computeErrors) return;
return this.creature.computeErrors.map(error => {
error.text = error.type;
if (error.type === 'dependencyLoop') {
error.text = 'Dependency Loop Detected';
}
});
if (!this.creature || !this.creature.computeErrors) return [];
return this.creature.computeErrors;
},
},
watch: {

View File

@@ -1,6 +1,5 @@
<template>
<v-alert
v-if="model && model.details && model.details.nodes && model.details.nodes.length"
border="bottom"
colored-border
elevation="2"