-
-
Notifications
You must be signed in to change notification settings - Fork 257
Closed
Labels
Description
Proposal
Currently, unsubscribing in the model is only possible within a Vue component on the unMounted event. However, we cannot exclude the case when Effector might be used in a composable, in which case the unMounted event might never occur. I have added the effectScope method, which allows you to unsubscribe at any moment upon request.
In its current form, useVModel has an optional argument effectScope(scope). Unsubscription occurs either on the scope.stop() event or on the unMounted event within the same onScopeDispose call, making this solution backward compatible.
A few more improvements:
- Fixed type inference when $store is passed to useVModel. A similar issue was observed in this issue.
- Updated the deepCopy function; instead of array.find, the new Map().get method is now used. However, I would also consider how we can do without it.
- Removed unnecessary reactive wrappers in useVModel.
Use case
Any use of useVModel in Vue composables without Vue components.