Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 控制台添加机器人,选择有多个protocol的adapter会报错无法显示设置表单 #738

Closed
Tracked by #725
samnyan opened this issue Jul 1, 2022 · 1 comment
Milestone

Comments

@samnyan
Copy link
Contributor

samnyan commented Jul 1, 2022

Describe the bug

在控制台添加机器人的页面,选择任意一个有多个protocol的adapter(也就是除了discord和qqguild),都会报错

vue.js:1 TypeError: Cannot read properties of undefined (reading 'type')

导致页面表单无法显示,无法添加机器人

Steps to reproduce

在机器人页面添加机器人,并且选择一个有多个protocol选项的adapter(如onebot)

Expected behavior

应显示对应adapter的配置表单

Screenshots

No response

Versions

  • OS: Windows 11
  • Platform: any
  • Node version: 16.15.0
  • Koishi version: 4.7.6

Additional context

const selectModel = computed({
get() {
if (active.value === props.schema) return
return active.value.meta.description || active.value.value
},
set(index) {
if (active.value === choices.value[index]) return
config.value = cache.value[index]
active.value = choices.value[index]
},
})

这里的174行的 active.value ,正常应该是一个object。
加了断点之后,这里选择adapter之后发生了两次调用,第一次调用的时候 active.value 是正常的object,第二次调用是数字 0,导致访问它的 .meta.description 直接报错。

@shigma
Copy link
Member

shigma commented Jul 12, 2022

Fixed by 91aad42.

@shigma shigma closed this as completed Jul 12, 2022
@shigma shigma added this to the 4.9 milestone Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants