1
1
mirror of https://github.com/theoludwig/theoludwig.git synced 2024-10-05 13:06:10 +02:00

fix: client-side age calculation, more glanular check for isMounted

Allows to render as much as possible on the server side.
While keeping the calculation of the age on the client side to avoid hydratation mismatch.
This commit is contained in:
Théo LUDWIG 2024-05-16 10:06:43 +02:00
parent bbb2e56512
commit b231381cb3
Signed by: theoludwig
GPG Key ID: ADFE5A563D718F3B

View File

@ -30,14 +30,17 @@ export const ProfileList = (props: ProfileListProps): JSX.Element => {
title={i18n.translate("home.about.pronouns")}
value={i18n.translate("home.about.pronouns-value")}
/>
{isMounted ? (
<ProfileItem
title={i18n.translate("home.about.birth-date")}
value={`${BIRTH_DATE_STRING} (${age} ${i18n.translate(
"home.about.years-old",
)})`}
/>
) : null}
<ProfileItem
title={i18n.translate("home.about.birth-date")}
value={
isMounted
? `${BIRTH_DATE_STRING} (${age} ${i18n.translate(
"home.about.years-old",
)})`
: BIRTH_DATE_STRING
}
/>
<ProfileItem
title={i18n.translate("home.about.nationality")}
value="Alsace, France"