Skip to content

Commit 7d82b01

Browse files
committed
fix: stabilize hackathon detail hydration
1 parent ebf6972 commit 7d82b01

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pages/hackathon/[id].tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ interface HackathonDetailProps {
7272
projects: Project[];
7373
templates: Template[];
7474
};
75+
renderedAt: number;
7576
}
7677

7778
export const getServerSideProps = compose<{ id: string }>(
@@ -99,12 +100,13 @@ export const getServerSideProps = compose<{ id: string }>(
99100
props: {
100101
activity,
101102
hackathon: { people, organizations, agenda, prizes, templates, projects },
103+
renderedAt: Date.now(),
102104
},
103105
};
104106
},
105107
);
106108

107-
const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackathon }) => {
109+
const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackathon, renderedAt }) => {
108110
const i18n = useContext(I18nContext);
109111
const { t } = i18n;
110112
const {
@@ -182,7 +184,7 @@ const HackathonDetail: FC<HackathonDetailProps> = observer(({ activity, hackatho
182184
};
183185
})
184186
.filter(({ date, label }) => Boolean(date && label));
185-
const now = Date.now();
187+
const now = renderedAt;
186188
const nextAgendaItem = agendaItems.find(({ startedAt, endedAt }) => {
187189
const started = new Date((startedAt as string) || 0).getTime();
188190
const ended = new Date((endedAt as string) || 0).getTime();

0 commit comments

Comments
 (0)