/* Copyright 2026 Marimo. All rights reserved. */ import { useAtomValue } from "jotai"; import { memo, useMemo } from "react"; import { cn } from "@/utils/cn"; import { createCellStateAtom } from "./atoms"; interface CellSelectionIndicatorProps { cellId: string; className?: string; } export const CellRangeSelectionIndicator = memo( ({ cellId, className }) => { // Create a derived atom that only updates when this specific cell's state changes const cellStateAtom = useMemo(() => createCellStateAtom(cellId), [cellId]); const { isSelected, isCopied } = useAtomValue(cellStateAtom); if (!isSelected && !isCopied) { return null; } return (
); }, ); CellRangeSelectionIndicator.displayName = "CellRangeSelectionIndicator";