diff --git a/app/[lang]/(live)/(protected)/my-pages/profile/@profile/page.tsx b/app/[lang]/(live)/(protected)/my-pages/profile/@profile/page.tsx index ad6458704..452444072 100644 --- a/app/[lang]/(live)/(protected)/my-pages/profile/@profile/page.tsx +++ b/app/[lang]/(live)/(protected)/my-pages/profile/@profile/page.tsx @@ -44,7 +44,7 @@ export default async function Profile({ params }: PageArgs) { diff --git a/components/Forms/Edit/Profile/index.tsx b/components/Forms/Edit/Profile/index.tsx index 1b40b80f1..6a4593d74 100644 --- a/components/Forms/Edit/Profile/index.tsx +++ b/components/Forms/Edit/Profile/index.tsx @@ -60,7 +60,7 @@ export default function Form({ user }: EditFormProps) { streetAddress: user.address.streetAddress ?? "", zipCode: user.address.zipCode ?? "", }, - dateOfBirth: user.dateOfBirth ?? "1900-01-01", + dateOfBirth: user.dateOfBirth, email: user.email, language: user.language ?? langToApiLang[lang], phoneNumber: phoneInput, diff --git a/components/TrackingSDK/Client.tsx b/components/TrackingSDK/Client.tsx index 0635455d9..37933ba96 100644 --- a/components/TrackingSDK/Client.tsx +++ b/components/TrackingSDK/Client.tsx @@ -1,9 +1,10 @@ "use client" import { usePathname } from "next/navigation" -import { useCallback, useEffect, useState } from "react" +import { useCallback, useEffect } from "react" import { webviews } from "@/constants/routes/webviews" +import useTrackingStore from "@/stores/tracking" import { createSDKPageObject } from "@/utils/tracking" @@ -12,7 +13,7 @@ import { TrackingSDKProps } from "@/types/components/tracking" export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) { const pathName = usePathname() const isWebview = webviews.includes(pathName) - const [initPerformanceTracking, setInitPerformanceTracking] = useState(true) + const { hasRun, setHasRun } = useTrackingStore() const CookiebotCallbackOnAccept = useCallback(() => { const cookie = window._satellite.cookie.get("CookieConsent") @@ -39,7 +40,7 @@ export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) { } useEffect(() => { - if (initPerformanceTracking) { + if (!hasRun) { const perfObserver = new PerformanceObserver((observedEntries) => { const entry = observedEntries.getEntriesByType("navigation")[0] @@ -61,9 +62,9 @@ export default function TrackingSDK({ pageData, userData }: TrackingSDKProps) { buffered: true, }) - setInitPerformanceTracking(false) + setHasRun() } - }, [pathName, pageData, userData, initPerformanceTracking]) + }, [pathName, pageData, userData, hasRun, setHasRun]) useEffect(() => { // handle consent diff --git a/server/routers/user/output.ts b/server/routers/user/output.ts index 1ac09f2f9..6b5c2925c 100644 --- a/server/routers/user/output.ts +++ b/server/routers/user/output.ts @@ -10,7 +10,7 @@ export const getUserSchema = z.object({ streetAddress: z.string().optional(), zipCode: z.string().optional(), }), - dateOfBirth: z.string().optional().default("N/A"), + dateOfBirth: z.string().optional().default("1900-01-01"), email: z.string().email(), firstName: z.string(), language: z.string().optional(), diff --git a/stores/tracking.ts b/stores/tracking.ts new file mode 100644 index 000000000..97ea29ac0 --- /dev/null +++ b/stores/tracking.ts @@ -0,0 +1,15 @@ +"use client" + +import { create } from "zustand" + +interface TrackingStoreState { + hasRun: boolean + setHasRun: () => void +} + +const useTrackingStore = create((set) => ({ + hasRun: false, + setHasRun: () => set(() => ({ hasRun: true })), +})) + +export default useTrackingStore