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

Feature: 支持 schema.reactive() #1153

Open
shigma opened this issue Jul 24, 2023 · 0 comments
Open

Feature: 支持 schema.reactive() #1153

shigma opened this issue Jul 24, 2023 · 0 comments

Comments

@shigma
Copy link
Member

shigma commented Jul 24, 2023

schema.reactive() 用于声明修改后即刻保存的配置项。

Schema.object({
  foo: Schema.string().reactive(),
  bar: Schema.string(),
  qux: Schema.object({
    foo: Schema.string().reactive(),
    bar: Schema.string(),
  }),
})

如果插件声明了上述的配置项,用户在控制台中修改配置时:

  • 改动 foo 或者 qux.foo:直接同步到配置文件
  • 改动 bar 或者 qux.bar:不同步到配置文件,需要手动点击「保存」或「启用」
  • 同时修改上述配置:只同步 reactive 的部分

对应的插件实现中,应当使用 ctx.accept() 接受 fooqux.foo 的改动,否则插件将会全量重载。

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

1 participant