diff --git a/src/App.tsx b/src/App.tsx index cf52664d..c2298f1b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -164,7 +164,8 @@ const App: React.FC<{ env: string }> = ({ env }) => { } const onSettingChange = (values: ISettingsForm) => { logseq.updateSettings({calendarList: 1, subscriptionList: 1}) - logseq.updateSettings(values) + // ensure subscription list is array + logseq.updateSettings({subscriptionList: [], ...values}) if (values.weekStartDay !== logseq.settings?.weekStartDay) { calendarRef.current?.setOptions({ week: { diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index b608fba6..1d4df3a8 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -155,7 +155,7 @@ const Settings: React.FC<{ - + diff --git a/src/util/util.ts b/src/util/util.ts index c709584d..987bd7ac 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -380,11 +380,11 @@ export const managePluginTheme = async () => { * get ical data */ export const getSubCalendarSchedules = async (subscriptionCalendarList: ISettingsForm['subscriptionList'], defaultDuration?: ISettingsForm['defaultDuration']) => { + if (!Array.isArray(subscriptionCalendarList)) return [] const enabledCalendarList = subscriptionCalendarList?.filter(calendar => calendar.enabled) if (!enabledCalendarList?.length) return [] const resList = await Promise.allSettled(enabledCalendarList.map(calendar => axios(calendar.url))) - // const resList = await Promise.allSettled(subscriptionCalendarList.map(calendar => ical.fromURL(calendar.url))) let schedules = [] resList.forEach((res, index) => {