update: remove useHooks usage
Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import useStore from './useStore'
|
||||
import {
|
||||
Connection,
|
||||
Edge,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
OnConnectStartParams,
|
||||
FlowInstance,
|
||||
FlowEvents,
|
||||
FlowStore,
|
||||
} from '~/types'
|
||||
import { Hooks } from '~/context'
|
||||
|
||||
@@ -66,10 +66,9 @@ const bind = (emit: EmitFunc, hooks: FlowHooks) => {
|
||||
}
|
||||
}
|
||||
|
||||
export default (emit?: EmitFunc) => {
|
||||
export default (store: FlowStore, emit?: EmitFunc) => {
|
||||
let hooks = inject(Hooks)!
|
||||
if (!hooks) {
|
||||
const store = useStore()
|
||||
if (import.meta.env.DEV) console.warn('hooks context not found; creating default hooks')
|
||||
hooks = store.hooks
|
||||
if (typeof emit === 'function') bind(emit, hooks)
|
||||
|
||||
Reference in New Issue
Block a user