refactor: extract useBlockSuite from useAppState (#1001)

This commit is contained in:
Himself65
2023-02-14 21:12:35 -06:00
committed by GitHub
parent 6c0db247b7
commit 5a0e4895cd
13 changed files with 160 additions and 110 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react';
import { EditorContainer } from '@blocksuite/editor';
import { useAppState } from '@/providers/app-state-provider';
import { useBlockSuite } from '@/store/workspace';
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 } = useAppState();
const editor = useBlockSuite(store => store.editor);
const callbackQueue = useRef<((editor: EditorContainer) => void)[]>([]);