update(types): remove promise from addelements
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> update(store): remove promise from setElements Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import microDiff from 'microdiff'
|
import microDiff from 'microdiff'
|
||||||
import { setActivePinia, createPinia, defineStore, StoreDefinition, acceptHMRUpdate } from 'pinia'
|
import { setActivePinia, createPinia, defineStore, StoreDefinition, acceptHMRUpdate } from 'pinia'
|
||||||
import { FlowState, FlowActions, Elements, FlowGetters, GraphNode, GraphEdge, Edge, NextElements } from '~/types'
|
import { FlowState, FlowActions, Elements, FlowGetters, GraphNode, GraphEdge, Edge } from '~/types'
|
||||||
import {
|
import {
|
||||||
getConnectedEdges,
|
getConnectedEdges,
|
||||||
getNodesInside,
|
getNodesInside,
|
||||||
@@ -10,8 +10,6 @@ import {
|
|||||||
isGraphNode,
|
isGraphNode,
|
||||||
getSourceTargetNodes,
|
getSourceTargetNodes,
|
||||||
isEdge,
|
isEdge,
|
||||||
processElements,
|
|
||||||
parseElement,
|
|
||||||
parseElements,
|
parseElements,
|
||||||
} from '~/utils'
|
} from '~/utils'
|
||||||
|
|
||||||
@@ -86,7 +84,7 @@ export default (id: string, preloadedState: FlowState) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async setElements(elements) {
|
setElements(elements) {
|
||||||
const { nodes, edges } = parseElements(elements, this.elements, this.nodeExtent)
|
const { nodes, edges } = parseElements(elements, this.elements, this.nodeExtent)
|
||||||
edges.forEach((edge: Edge, i, arr) => {
|
edges.forEach((edge: Edge, i, arr) => {
|
||||||
const { sourceNode, targetNode } = getSourceTargetNodes(edge, nodes)
|
const { sourceNode, targetNode } = getSourceTargetNodes(edge, nodes)
|
||||||
|
|||||||
+1
-1
@@ -73,7 +73,7 @@ export interface FlowState extends Omit<FlowOptions, 'elements'> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface FlowActions {
|
export interface FlowActions {
|
||||||
setElements: (elements: Elements) => Promise<void>
|
setElements: (elements: Elements) => void
|
||||||
setUserSelection: (mousePos: XYPosition) => void
|
setUserSelection: (mousePos: XYPosition) => void
|
||||||
updateUserSelection: (mousePos: XYPosition) => void
|
updateUserSelection: (mousePos: XYPosition) => void
|
||||||
unsetUserSelection: () => void
|
unsetUserSelection: () => void
|
||||||
|
|||||||
Reference in New Issue
Block a user