refactor: use useCallback (#3254)

(cherry picked from commit c0749fbb9f)
This commit is contained in:
Alex Yang
2023-07-17 11:31:06 +08:00
parent b40051e4a4
commit efdf6c2b81
4 changed files with 22 additions and 18 deletions
@@ -109,7 +109,7 @@ export const BlockSuitePageList: React.FC<BlockSuitePageListProps> = ({
const { createPage, createEdgeless, importFile, isPreferredEdgeless } =
usePageHelper(blockSuiteWorkspace);
const t = useAFFiNEI18N();
const getPageInfo = useGetPageInfoById();
const getPageInfo = useGetPageInfoById(blockSuiteWorkspace);
const tagOptionMap = useMemo(
() =>
Object.fromEntries(
@@ -255,7 +255,7 @@ const CollectionRenderer = ({
export const CollectionsList = ({ workspace }: CollectionsListProps) => {
const metas = useBlockSuitePageMeta(workspace);
const { savedCollections } = useSavedCollections(workspace.id);
const getPageInfo = useGetPageInfoById();
const getPageInfo = useGetPageInfoById(workspace);
return (
<div data-testid="collections" className={styles.wrapper}>
{savedCollections
+3 -1
View File
@@ -35,7 +35,9 @@ export function WorkspaceHeader({
const currentWorkspace = useWorkspace(currentWorkspaceId);
const getPageInfoById = useGetPageInfoById();
const getPageInfoById = useGetPageInfoById(
currentWorkspace.blockSuiteWorkspace
);
if ('subPath' in currentEntry) {
if (currentEntry.subPath === WorkspaceSubPath.ALL) {
const leftSlot = (