Hotfix: For old Plausible installs enabled in an EventType, give a default value (#6860)

* Add default for trackingId for old plausible installs in event-types

* Fix types
pull/6877/head
Hariom Balhara 2023-02-04 03:08:06 +05:30 committed by GitHub
parent 9b26c7aee6
commit 75509c97fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -4,7 +4,9 @@ import { eventTypeAppCardZod } from "../eventTypeAppCardZod";
export const appDataSchema = eventTypeAppCardZod.merge(
z.object({
trackingId: z.string(),
// FIXME: Due to some reason autogenerated zod schema at prisma/zod/eventtype.ts fails typecheck on using `.default()`. It somehow thinks that trackingId can be undefined
// z.lazy has something to do with it. Figure it out later.
trackingId: z.string().default("") as unknown as z.ZodString,
})
);