chore(zustand): upgrade to v4

This commit is contained in:
moklick
2022-08-06 16:57:32 +02:00
parent 6f6af23bf5
commit 753f442468
35 changed files with 126 additions and 55 deletions
@@ -1,8 +1,8 @@
import { useEffect } from 'react';
import { SetState } from 'zustand';
import { StoreApi } from 'zustand';
import shallow from 'zustand/shallow';
import { useStore, useStoreApi } from '../../store';
import { useStore, useStoreApi } from '../../hooks/useStore';
import { Node, Edge, ReactFlowState, CoordinateExtent, ReactFlowProps } from '../../types';
type StoreUpdaterProps = Pick<
@@ -61,7 +61,7 @@ function useStoreUpdater<T>(value: T | undefined, setStoreState: (param: T) => v
}, [value]);
}
function useDirectStoreUpdater(key: keyof ReactFlowState, value: any, setState: SetState<ReactFlowState>) {
function useDirectStoreUpdater(key: keyof ReactFlowState, value: any, setState: StoreApi<ReactFlowState>['setState']) {
useEffect(() => {
if (typeof value !== 'undefined') {
// @ts-ignore