From 7736915720281c48cfbe4861a16e5b1b7d5a4e48 Mon Sep 17 00:00:00 2001 From: Braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 15 Dec 2021 10:11:23 +0100 Subject: [PATCH] feat(flow): Add state as refs, getters and actions to vueFlow object for easier access Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com> --- src/composables/useVueFlow.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/composables/useVueFlow.ts b/src/composables/useVueFlow.ts index 407ca418..27b53dad 100644 --- a/src/composables/useVueFlow.ts +++ b/src/composables/useVueFlow.ts @@ -11,11 +11,13 @@ export default (options?: FlowOptions): UseVueFlow => { : false if (!vueFlow || (vueFlow && options?.id && options.id !== vueFlow.id)) { const name = options?.id ?? `vue-flow-${id++}` - const store = reactive(useStore(name, options)) + const store = useStore(name, options) vueFlow = { id: name, - store, - ...toRefs(store), + store: reactive(store), + ...toRefs(store.state), + ...store.getters, + ...store.actions, ...store.hooksOn, } }