Avoid creating dynamic HTML (#4669)

pull/4546/head
Hariom Balhara 2022-09-22 19:13:45 +05:30 committed by GitHub
parent 6e2e252c49
commit f628ac4366
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -51,7 +51,7 @@ const DestinationCalendarSelector = ({
if (selected) { if (selected) {
setSelectedOption({ setSelectedOption({
value: `${selected.integration}:${selected.externalId}`, value: `${selected.integration}:${selected.externalId}`,
label: `<span class="font-semibold">${selected.name}</span> (${selected.externalId})` || "", label: `${selected.name} (${selected.externalId})` || "",
}); });
} }
}, [query.data?.connectedCalendars, value]); }, [query.data?.connectedCalendars, value]);
@ -66,7 +66,7 @@ const DestinationCalendarSelector = ({
options: (selectedCalendar.calendars ?? []) options: (selectedCalendar.calendars ?? [])
.filter((cal) => cal.readOnly === false) .filter((cal) => cal.readOnly === false)
.map((cal) => ({ .map((cal) => ({
label: `<span class="font-semibold">${cal.name}</span> (${cal.externalId})` || "", label: `${cal.name} (${cal.externalId})` || "",
value: `${cal.integration}:${cal.externalId}`, value: `${cal.integration}:${cal.externalId}`,
})), })),
})) ?? []; })) ?? [];
@ -83,9 +83,6 @@ const DestinationCalendarSelector = ({
title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}> title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
<Select <Select
name="primarySelectedCalendar" name="primarySelectedCalendar"
formatOptionLabel={function (data) {
return <span dangerouslySetInnerHTML={{ __html: data.label }} />;
}}
placeholder={ placeholder={
!hidePlaceholder ? ( !hidePlaceholder ? (
`${t("select_destination_calendar")}` `${t("select_destination_calendar")}`