fix: non-existent method call and empty project dropdown in settings

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
HeroBlackInk 2026-02-22 13:31:31 +08:00
parent a425ff6083
commit eb32a6a985

View file

@ -135,6 +135,10 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
);
const myProjectsOptions: Record<string, string> = {};
const projects = this.plugin.todoistSyncAPI?.getSyncData()?.projects || [];
for (const p of projects) {
myProjectsOptions[p.id] = p.name;
}
new Setting(containerEl)
.setName('Default Project')
@ -144,7 +148,7 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
.addOption(this.plugin.settings.defaultProjectId, this.plugin.settings.defaultProjectName)
.addOptions(myProjectsOptions)
.onChange(async (value) => {
const project = this.plugin.todoistSyncAPI?.getSyncData()?.projects?.find((p: any) => p.id === value);
const project = projects.find((p: any) => p.id === value);
await this.plugin.safeSettings?.update({
defaultProjectId: value,
defaultProjectName: project?.name || value
@ -263,12 +267,10 @@ export class UltimateTodoistSyncSettingTab extends PluginSettingTab {
return
}
try {
await this.plugin.scheduledSynchronization()
this.plugin.syncLock = false
await this.plugin.scheduler.run()
new Notice('Sync completed.')
} catch (error) {
new Notice(`Sync error: ${error}`)
this.plugin.syncLock = false;
}
})
);