Set a default for "create events on" (#2215)
* fix: 🐛 Set a default for create events on * fix: 🐛 Save default value to db * Revert fixes in frontend * fix: 🐛 Set a default for "create events on" from backend" * fix: 🐛 Update frontend when destinationCalendar is disconnected
This commit is contained in:
1 parent
4a58da62d6
commit
0494fccb8e
2 files changed
+54
-12
No files matched your search
@@ -25,20 +25,18 @@ const DestinationCalendarSelector = ({
|
||||
const [selectedOption, setSelectedOption] = useState<{ value: string; label: string } | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (!selectedOption) {
|
||||
const selected = query.data?.connectedCalendars
|
||||
.map((connected) => connected.calendars ?? [])
|
||||
.flat()
|
||||
.find((cal) => cal.externalId === value);
|
||||
const selected = query.data?.connectedCalendars
|
||||
.map((connected) => connected.calendars ?? [])
|
||||
.flat()
|
||||
.find((cal) => cal.externalId === value);
|
||||
|
||||
if (selected) {
|
||||
setSelectedOption({
|
||||
value: `${selected.integration}:${selected.externalId}`,
|
||||
label: selected.name || "",
|
||||
});
|
||||
}
|
||||
if (selected) {
|
||||
setSelectedOption({
|
||||
value: `${selected.integration}:${selected.externalId}`,
|
||||
label: selected.name || "",
|
||||
});
|
||||
}
|
||||
}, [query.data?.connectedCalendars, selectedOption, value]);
|
||||
}, [query.data?.connectedCalendars, value]);
|
||||
|
||||
if (!query.data?.connectedCalendars.length) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user