fix: on data change trigger history update for undo redo
This commit is contained in:
parent
4e93f6cc7b
commit
f209474ba0
3 changed files with 16 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { Handle, useVueFlow } from "@vue-flow/core";
|
||||
import { watch } from "vue";
|
||||
import { watch, computed } from "vue";
|
||||
import { useStore } from "../store";
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -35,11 +35,17 @@ watch(
|
|||
connected_edges.forEach(edge => edge.selected = val);
|
||||
}
|
||||
);
|
||||
|
||||
let label = computed(() => findNode(props.node.id)?.data?.action);
|
||||
|
||||
watch(() => props.node.data, () => {
|
||||
store.ref_history.commit();
|
||||
}, { deep: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="node" tabindex="0" @click.stop="store.workflow.selected = node">
|
||||
<div v-if="node.data.action" class="node-label">{{ node.data.action }}</div>
|
||||
<div v-if="label" class="node-label">{{ label }}</div>
|
||||
<div v-else class="node-placeholder text-muted">{{ __("No Label") }}</div>
|
||||
<Handle
|
||||
v-for="handle in ['top', 'right', 'bottom', 'left']"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<script setup>
|
||||
import { Handle, useVueFlow } from "@vue-flow/core";
|
||||
import { watch } from "vue";
|
||||
import { watch, computed } from "vue";
|
||||
import { useStore } from "../store";
|
||||
|
||||
const props = defineProps({
|
||||
|
|
@ -29,11 +29,17 @@ watch(
|
|||
store.workflow.selected = val ? props.node : "";
|
||||
}
|
||||
);
|
||||
|
||||
let label = computed(() => findNode(props.node.id)?.data?.state);
|
||||
|
||||
watch(() => props.node.data, () => {
|
||||
store.ref_history.commit();
|
||||
}, { deep: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="node" tabindex="0" @click.stop="store.workflow.selected = node">
|
||||
<div v-if="node.data.state" class="node-label">{{ node.data.state }}</div>
|
||||
<div v-if="label" class="node-label">{{ label }}</div>
|
||||
<div v-else class="node-placeholder text-muted">{{ __("No Label") }}</div>
|
||||
<Handle
|
||||
v-for="handle in ['top', 'right', 'bottom', 'left']"
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ export const useStore = defineStore("workflow-builder-store", () => {
|
|||
let ref_history = ref(null);
|
||||
|
||||
async function fetch() {
|
||||
workflow.value.elements = [];
|
||||
await frappe.model.clear_doc("Workflow", workflow_name.value);
|
||||
await frappe.model.with_doc("Workflow", workflow_name.value);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue