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): remove useless logic of use favorite (#7533)

forehalo133888d76094
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-header/favorite/index.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-header/favorite/index.tsx
index 6b46fd9910..7f9e72b89a 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-header/favorite/index.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-header/favorite/index.tsx
@@ -2,8 +2,7 @@ import { FavoriteTag } from '@affine/core/components/page-list';
import { FavoriteItemsAdapter } from '@affine/core/modules/properties';
import { toast } from '@affine/core/utils';
import { useI18n } from '@affine/i18n';
-import { assertExists } from '@blocksuite/global/utils';
-import { useLiveData, useService, WorkspaceService } from '@toeverything/infra';
+import { useLiveData, useService } from '@toeverything/infra';
import { useCallback } from 'react';
export interface FavoriteButtonProps {
@@ -12,11 +11,7 @@ export interface FavoriteButtonProps {
export const useFavorite = (pageId: string) => {
const t = useI18n();
- const workspace = useService(WorkspaceService).workspace;
- const docCollection = workspace.docCollection;
- const currentPage = docCollection.getDoc(pageId);
const favAdapter = useService(FavoriteItemsAdapter);
- assertExists(currentPage);
const favorite = useLiveData(favAdapter.isFavorite$(pageId, 'doc'));