chore(useStore): cleanup
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { useContext, useMemo } from 'react';
|
||||
import { useStoreWithEqualityFn as useZustandStore } from 'zustand/traditional';
|
||||
import type { StoreApi } from 'zustand';
|
||||
import { errorMessages } from '@xyflow/system';
|
||||
|
||||
import StoreContext from '../contexts/RFStoreContext';
|
||||
@@ -8,8 +7,6 @@ import type { ReactFlowState } from '../types';
|
||||
|
||||
const zustandErrorMessage = errorMessages['error001']();
|
||||
|
||||
type ExtractState = StoreApi<ReactFlowState> extends { getState: () => infer T } ? T : never;
|
||||
|
||||
/**
|
||||
* Hook for accessing the internal store. Should only be used in rare cases.
|
||||
*
|
||||
@@ -18,7 +15,8 @@ type ExtractState = StoreApi<ReactFlowState> extends { getState: () => infer T }
|
||||
* @param equalityFn
|
||||
* @returns The selected state slice
|
||||
*/
|
||||
function useStore<StateSlice = ExtractState>(
|
||||
|
||||
function useStore<StateSlice = unknown>(
|
||||
selector: (state: ReactFlowState) => StateSlice,
|
||||
equalityFn?: (a: StateSlice, b: StateSlice) => boolean
|
||||
) {
|
||||
|
||||
@@ -45,7 +45,7 @@ import type {
|
||||
OnBeforeDelete,
|
||||
} from '.';
|
||||
|
||||
export type ReactFlowStore<NodeType extends Node> = {
|
||||
export type ReactFlowStore<NodeType extends Node = Node> = {
|
||||
rfId: string;
|
||||
width: number;
|
||||
height: number;
|
||||
|
||||
Reference in New Issue
Block a user