-
Notifications
You must be signed in to change notification settings - Fork 13
Add a possibility to work with setter of mobx fields #14
Conversation
Thanks for your work @lacedon . Seems that you used vue's I have be wondering if we can realize Since we rarely need setter (maybe I'm wrong, but I do not like the getter/setter way), we can get clean realization in most times. Hope for your idea. |
src/install.ts
Outdated
}) | ||
|
||
vm[movueDisposersKey] = disposers |
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.
Another thing I care about here: when there is no fromMobx
part in the component definition, it will be better for us not to set the __movueDisposers__
field of the component. That makes normal components cleaner.
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.
I agree. I will refactor that code.
I agree, that it's little bit complicated, but I'm not sure about debugging. Also I think if we do that in one style it will be easier to understand code of plugin. And beside that, if component have |
I agree that There is another way that extra |
Great idea! I created a file |
src/install.ts
Outdated
} | ||
|
||
changeDetector.removeReactionList(vm) | ||
getFromStoreEntries(vm).map(({ key }) => changeDetector.removeReactiveProperty(vm, key)) |
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.
Maybe forEach
will be better here than map
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.
I agree. Fixed that.
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.
👍
#13
I add a possibility to add setter like this: