Fixes Dynamic Link description Logic (#4351)

* fixes logic

* fixes description

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Syed Ali Shahbazandkodiakhq[bot] authored and GitHub committed 2022-09-12 15:34:42 +05:30
1 parent 20fd45a3fd
commit 9557c1818b
2 files changed
+4 -3

No files matched your search

@@ -1,13 +1,11 @@
export type EventTypeDescriptionSafeProps = {
eventType: { description: string | null; isDynamic?: boolean };
eventType: { description: string | null };
};
export const EventTypeDescriptionSafeHTML = ({ eventType }: EventTypeDescriptionSafeProps) => {
const props: JSX.IntrinsicElements["div"] = { suppressHydrationWarning: true };
// @ts-expect-error: @see packages/prisma/middleware/eventTypeDescriptionParseAndSanitize.ts
if (eventType.description) props.dangerouslySetInnerHTML = { __html: eventType.descriptionAsSafeHTML };
// Dynamic link description is not set/pulled from the DB, hence we can allow it here as is
if (eventType.isDynamic) props.dangerouslySetInnerHTML = { __html: eventType.description || "" };
return <div {...props} />;
};