-
Notifications
You must be signed in to change notification settings - Fork 10
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
make addDisposer public #88
Conversation
dumi/docs/concepts/state/index.md
Outdated
/** Do dispose. */ | ||
dispose(): void | ||
/** Collect the disposer function. */ | ||
addDisposer(disposer: Disposer): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是需要加到 IState
上的吗?以及我看 IState
对应的代码并还没有加?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有道理 现在加了 4420cd3
加之前就能用是因为实际上都 extends 了 Disposable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加之前就能用是因为实际上都 extends 了 Disposable
那是不是说明在具体的实现(FieldState
、FormState
、..)上有 addDisposer
平时就够用了,而不一定要体现在接口上?
体现在接口上的话会给每个对接口的实现(包括当下的跟将来的)增加负担
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
也行
不过文档哪里适合写这个呢(哪些有 add disposer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过文档哪里适合写这个呢(哪些有 add disposer)
不用写在文档里吧,自己通过 TS 的类型就能发现;事实上是绝大部分内置的 class XxxState
都有 addDisposer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
事实上是绝大部分内置的
class XxxState
都有addDisposer
对
case: add disposer (sth like mobx reaction) in react hooks
resolve react dev version