diff --git a/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx b/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx index 22ec9cb26..4d46a90e3 100644 --- a/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx +++ b/src/components/shared/Dialogs/ComponentDuplicateDialog.test.tsx @@ -45,17 +45,14 @@ const createMockComponentLibraryContext = ( error: null, existingComponentLibraries: undefined, searchResult: null, - highlightedComponentDigest: null, searchComponentLibrary: vi.fn(), addToComponentLibrary: vi.fn(), removeFromComponentLibrary: vi.fn(), refetchLibrary: vi.fn(), refetchUserComponents: vi.fn(), - setHighlightedComponentDigest: vi.fn(), setComponentFavorite: vi.fn(), checkIfUserComponent: vi.fn().mockReturnValue(false), checkLibraryContainsComponent: vi.fn().mockReturnValue(false), - checkIfHighlighted: vi.fn().mockReturnValue(false), getComponentLibrary: vi.fn(), }; }; diff --git a/src/components/shared/ReactFlow/FlowSidebar/components/ComponentItem.tsx b/src/components/shared/ReactFlow/FlowSidebar/components/ComponentItem.tsx index 52fa46f04..63cac94d3 100644 --- a/src/components/shared/ReactFlow/FlowSidebar/components/ComponentItem.tsx +++ b/src/components/shared/ReactFlow/FlowSidebar/components/ComponentItem.tsx @@ -13,7 +13,6 @@ import { Skeleton } from "@/components/ui/skeleton"; import { Spinner } from "@/components/ui/spinner"; import { useHydrateComponentReference } from "@/hooks/useHydrateComponentReference"; import { cn } from "@/lib/utils"; -import { useComponentLibrary } from "@/providers/ComponentLibraryProvider"; import { type ComponentReference, type TaskSpec } from "@/utils/componentSpec"; import { getComponentName } from "@/utils/getComponentName"; import { isSubgraph } from "@/utils/subgraphUtils"; @@ -83,7 +82,6 @@ const ComponentMarkup = ({ // TODO: respect selected node as a starting point const carousel = useRef(0); - const { checkIfHighlighted } = useComponentLibrary(); const { notifyNode, getNodeIdsByDigest, fitNodeIntoView } = useNodesOverlay(); const { spec, digest, url, name, published_by: author, owned } = component; @@ -177,7 +175,6 @@ const ComponentMarkup = ({ error ? "cursor-not-allowed opacity-60" : "cursor-grab hover:bg-gray-100 active:bg-gray-200", - checkIfHighlighted(component) && "bg-orange-100", )} draggable={!error && !isLoading} onDragStart={onDragStart} diff --git a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx index 766efa3d6..8f6f37d43 100644 --- a/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx +++ b/src/providers/ComponentLibraryProvider/ComponentLibraryProvider.tsx @@ -76,7 +76,6 @@ type ComponentLibraryContextType = { existingComponentLibraries: StoredLibrary[] | undefined; searchResult: SearchResult | null; - highlightedComponentDigest: string | null; searchComponentLibrary: ( search: string, filters: string[], @@ -88,14 +87,12 @@ type ComponentLibraryContextType = { refetchLibrary: () => void; refetchUserComponents: () => void; - setHighlightedComponentDigest: (digest: string | null) => void; setComponentFavorite: ( component: ComponentReference, favorited: boolean, ) => void; checkIfUserComponent: (component: ComponentReference) => boolean; checkLibraryContainsComponent: (component: ComponentReference) => boolean; - checkIfHighlighted: (component: ComponentReference) => boolean; getComponentLibrary: (libraryName: AvailableComponentLibraries) => Library; }; @@ -179,10 +176,6 @@ export const ComponentLibraryProvider = ({ const [userComponentsFolder, setUserComponentsFolder] = useState(); - const [highlightedComponentDigest, setHighlightedComponentDigest] = useState< - string | null - >(null); - const [existingComponent, setExistingComponent] = useState(null); const [newComponent, setNewComponent] = @@ -365,13 +358,6 @@ export const ComponentLibraryProvider = ({ [componentLibrary, checkIfUserComponent], ); - const checkIfHighlighted = useCallback( - (component: ComponentReference) => { - return component.digest === highlightedComponentDigest; - }, - [highlightedComponentDigest], - ); - /** * Local component library search */ @@ -602,7 +588,6 @@ export const ComponentLibraryProvider = ({ isLoading, error, searchResult, - highlightedComponentDigest, existingComponentLibraries, searchComponentLibrary, getComponentLibrary, @@ -610,11 +595,9 @@ export const ComponentLibraryProvider = ({ removeFromComponentLibrary, refetchLibrary, refetchUserComponents, - setHighlightedComponentDigest, setComponentFavorite, checkIfUserComponent, checkLibraryContainsComponent, - checkIfHighlighted, }), [ componentLibrary, @@ -624,7 +607,6 @@ export const ComponentLibraryProvider = ({ isLoading, error, searchResult, - highlightedComponentDigest, existingComponentLibraries, searchComponentLibrary, getComponentLibrary, @@ -632,11 +614,9 @@ export const ComponentLibraryProvider = ({ removeFromComponentLibrary, refetchLibrary, refetchUserComponents, - setHighlightedComponentDigest, setComponentFavorite, checkIfUserComponent, checkLibraryContainsComponent, - checkIfHighlighted, ], );