diff --git a/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx b/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx index 31cc9421b..22ec9cb26 100644 --- a/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx +++ b/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx @@ -53,7 +53,6 @@ const createMockComponentLibraryContext = ( refetchUserComponents: vi.fn(), setHighlightedComponentDigest: vi.fn(), setComponentFavorite: vi.fn(), - checkIfFavorited: vi.fn().mockReturnValue(false), checkIfUserComponent: vi.fn().mockReturnValue(false), checkLibraryContainsComponent: vi.fn().mockReturnValue(false), checkIfHighlighted: vi.fn().mockReturnValue(false), diff --git a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.test.tsx b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.test.tsx index b4b2bc8ed..7e9fa5b30 100644 --- a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.test.tsx +++ b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.test.tsx @@ -645,28 +645,5 @@ describe("ComponentLibraryProvider - Component Management", () => { favorited: true, }); }); - - it("should check if component is favorited correctly", async () => { - const favoritedComponent: ComponentReference = { - name: "favorited-component", - digest: "fav-digest", - spec: mockComponentSpec, - favorited: true, - }; - - mockFlattenFolders.mockReturnValue([favoritedComponent]); - mockFilterToUniqueByDigest.mockReturnValue([favoritedComponent]); - - const { result } = renderHook(() => useComponentLibrary(), { - wrapper: createWrapper, - }); - - await waitFor(() => { - expect(result.current.isLoading).toBe(false); - }); - - const isFavorited = result.current.checkIfFavorited(favoritedComponent); - expect(isFavorited).toBe(true); - }); }); }); diff --git a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx index 3cb2168b0..766efa3d6 100644 --- a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx +++ b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx @@ -93,10 +93,6 @@ type ComponentLibraryContextType = { component: ComponentReference, favorited: boolean, ) => void; - /** - * @deprecated - */ - checkIfFavorited: (component: ComponentReference) => boolean; checkIfUserComponent: (component: ComponentReference) => boolean; checkLibraryContainsComponent: (component: ComponentReference) => boolean; checkIfHighlighted: (component: ComponentReference) => boolean; @@ -341,41 +337,6 @@ export const ComponentLibraryProvider = ({ [refreshComponentLibrary, refreshUserComponents], ); - const checkIfFavorited = useCallback( - (component: ComponentReference) => { - if (componentLibrary) { - const uniqueLibraryComponents = filterToUniqueByDigest( - flattenFolders(componentLibrary), - ); - - const isFavourited = uniqueLibraryComponents.some( - (c) => c.digest === component.digest && c.favorited, - ); - - if (isFavourited) { - return true; - } - } - - if (userComponentsFolder) { - const uniqueUserComponents = filterToUniqueByDigest( - flattenFolders(userComponentsFolder), - ); - - const isFavourited = uniqueUserComponents.some( - (c) => c.digest === component.digest && c.favorited, - ); - - if (isFavourited) { - return true; - } - } - - return false; - }, - [componentLibrary, userComponentsFolder], - ); - const checkIfUserComponent = useCallback( (component: ComponentReference) => { if (!userComponentsFolder) return false; @@ -651,7 +612,6 @@ export const ComponentLibraryProvider = ({ refetchUserComponents, setHighlightedComponentDigest, setComponentFavorite, - checkIfFavorited, checkIfUserComponent, checkLibraryContainsComponent, checkIfHighlighted, @@ -674,7 +634,6 @@ export const ComponentLibraryProvider = ({ refetchUserComponents, setHighlightedComponentDigest, setComponentFavorite, - checkIfFavorited, checkIfUserComponent, checkLibraryContainsComponent, checkIfHighlighted,