import { DatasetItemDiffView } from "./DatasetItemDiffView"; import type { DatasetItemDomain } from "@langfuse/shared"; import { stringifyDatasetItemData, type DatasetSchema, } from "../utils/datasetItemUtils"; import { DatasetItemFields } from "@/src/features/datasets/components/DatasetItemFields"; type DatasetItemVersionedContentProps = { itemAtVersion: DatasetItemDomain | null; latestItem: DatasetItemDomain | null; isLoadingVersioned: boolean; isLoadingLatest: boolean; showDiffMode: boolean; itemChangedAtVersion: boolean; dataset: DatasetSchema | null; }; /** * Renders a dataset item at a specific historical version. * Supports diff view comparison with the latest version. * Handles loading states and cases where item doesn't exist at that version. */ export const DatasetItemVersionedContent = ({ itemAtVersion, latestItem, isLoadingVersioned, isLoadingLatest, showDiffMode, itemChangedAtVersion, dataset, }: DatasetItemVersionedContentProps) => { // Loading states if (isLoadingVersioned) { return
Loading...
; } // Item doesn't exist at this version if (itemAtVersion === null) { return (

Item does not exist at this version

This dataset item either had not been created yet or was deleted at the selected version timestamp.

); } // Show diff mode if enabled and item changed at this version if (showDiffMode && itemChangedAtVersion) { if (isLoadingLatest) { return
Loading...
; } // Can't show diff if latest doesn't exist if (latestItem === null) { return (

Cannot show diff

The latest version of this item does not exist (has been deleted).

); } return ( ); } // Show normal view of selected version return ( ); };