Skip to content

Commit

Permalink
Fixed bug where clicking the latest date on the graph would not take …
Browse files Browse the repository at this point in the history
…you to the live-updating page
  • Loading branch information
mattpocock committed Dec 10, 2024
1 parent a97b592 commit 6533760
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/evalite-ui/app/routes/eval.$name.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ export default function Page() {

const timestamp = search.get("timestamp");

const latestDate = history[history.length - 1]?.date;

const isNotViewingLatest = timestamp && timestamp !== latestDate;

return (
<>
<InnerPageLayout
Expand All @@ -100,7 +104,7 @@ export default function Page() {
<Separator orientation="vertical" className="h-4 mx-4" />
<div className="flex items-center space-x-5">
<LiveDate date={evaluation.created_at} className="block" />
{timestamp && (
{isNotViewingLatest && (
<>
<Link
to={`/eval/${name}`}
Expand Down Expand Up @@ -140,7 +144,11 @@ export default function Page() {
<MyLineChart
data={history}
onDotClick={({ date }) => {
setSearch({ timestamp: date });
if (date === latestDate) {
setSearch({});
} else {
setSearch({ timestamp: date });
}
}}
/>
)}
Expand Down

0 comments on commit 6533760

Please sign in to comment.