Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): edit button missing in shared page (#6398)

JimmFlye33ab170d76a
diff --git a/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx b/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx
index bd777ce815..ce1f616c09 100644
--- a/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx
+++ b/packages/frontend/core/src/components/cloud/share-header-right-item/authenticated-item.tsx
@@ -1,8 +1,7 @@
import { Button } from '@affine/component/ui/button';
-import { useCurrentUser } from '@affine/core/hooks/affine/use-current-user';
-import { useMembers } from '@affine/core/hooks/affine/use-members';
import { useNavigateHelper } from '@affine/core/hooks/use-navigate-helper';
import { useAFFiNEI18N } from '@affine/i18n/hooks';
+import { useLiveData, useService, WorkspaceManager } from '@toeverything/infra';
import { useCallback, useEffect } from 'react';
import type { ShareHeaderRightItemProps } from './index';
@@ -13,9 +12,12 @@ export const AuthenticatedItem = ({
...props
}: { setIsMember: (value: boolean) => void } & ShareHeaderRightItemProps) => {
const { workspaceId, pageId } = props;
- const user = useCurrentUser();
- const members = useMembers(workspaceId, 0);
- const isMember = members.some(m => m.id === user.id);
+
+ const workspaceManager = useService(WorkspaceManager);
+ const workspaceList = useLiveData(workspaceManager.list.workspaceList$);
+ const isMember = workspaceList?.some(
+ workspace => workspace.id === workspaceId
+ );
const t = useAFFiNEI18N();
const { jumpToPage } = useNavigateHelper();