refactor(types): use same structure for nodes and edges
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
|
||||
import { useReactFlow } from './useReactFlow';
|
||||
import type { OnInit, Node } from '../types';
|
||||
import type { OnInit, Node, Edge } from '../types';
|
||||
|
||||
/**
|
||||
* Hook for calling onInit handler.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function useOnInitHandler<NodeType extends Node = Node>(onInit: OnInit<NodeType> | undefined) {
|
||||
const rfInstance = useReactFlow<NodeType>();
|
||||
export function useOnInitHandler<NodeType extends Node = Node, EdgeType extends Edge = Edge>(
|
||||
onInit: OnInit<NodeType, EdgeType> | undefined
|
||||
) {
|
||||
const rfInstance = useReactFlow<NodeType, EdgeType>();
|
||||
const isInitialized = useRef<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user