refactor(store): port to useGlobalState with zustand (#1012)

This commit is contained in:
Himself65
2023-02-14 23:38:21 -06:00
committed by GitHub
parent 2b3ec1240a
commit 6a8aff9e56
29 changed files with 304 additions and 207 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react';
import { EditorContainer } from '@blocksuite/editor';
import { useBlockSuite } from '@/store/workspace';
import { useGlobalState } from '@/store/app';
export type EventCallBack<T> = (callback: (props: T) => void) => void;
export type UsePropsUpdated = (
@@ -8,7 +8,7 @@ export type UsePropsUpdated = (
) => EventCallBack<EditorContainer>;
export const usePropsUpdated: UsePropsUpdated = () => {
const editor = useBlockSuite(store => store.editor);
const editor = useGlobalState(store => store.editor);
const callbackQueue = useRef<((editor: EditorContainer) => void)[]>([]);