Fixed history id error

This commit is contained in:
Emir Karabeg
2025-01-29 10:01:40 -08:00
parent 2a55ae9563
commit 5ee1a8c299
2 changed files with 5 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ interface HistoryDropdownItemProps {
timestamp: number
onClick?: () => void
isCurrent?: boolean
id?: string
}
export function HistoryDropdownItem({
@@ -15,6 +16,7 @@ export function HistoryDropdownItem({
timestamp,
onClick,
isCurrent = false,
id,
}: HistoryDropdownItemProps) {
const timeAgo = formatDistanceToNow(timestamp, { addSuffix: true })

View File

@@ -62,15 +62,15 @@ export function ControlBar() {
<DropdownMenuContent align="end" className="w-60">
<>
<HistoryDropdownItem
key={history.present.timestamp}
key={`current-${history.present.timestamp}`}
action={history.present.action}
timestamp={history.present.timestamp}
isCurrent={true}
onClick={() => {}}
/>
{[...history.past].reverse().map((entry) => (
{[...history.past].reverse().map((entry, index) => (
<HistoryDropdownItem
key={entry.timestamp}
key={`past-${entry.timestamp}-${index}`}
action={entry.action}
timestamp={entry.timestamp}
onClick={undo}