-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
introduce @shallowObservable #55
Labels
Milestone
Comments
I would rather you not break the current API, and just do @shallowObservable |
makes sense to me. |
I really like the notion of Besides that I'll add this issue for general reconsideration in a 2.0 api |
This was referenced Dec 6, 2015
17 tasks
mweststrate
changed the title
suggestion: make observable shallow by default.
introduce @shallowObservable
Feb 26, 2016
Closed in favor of the discussion in #211 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When you make an array observable:
... and assign it a value:
...the baz value becomes a setter/getter implicitly, so saying something like:
Ends up being broken and not what you expect. This is because mobservable is recursing through added things and implicitily observable-ifying them.
Instead what would be more intuitive would be to do shallow observation by default, with optional recursive behavior:
Then, if we want foo to recurse, we explain that explicitly:
Arrays in particular are a bit ambiguous and I could go either way. I think i'm ok mutating a vanilla array into an observable array by default, but I'm not keen on going any farther without an opt in behavior.
... but you could opt in of course, to recurse.
Though, a more pure solution would be to require wrapping an array with an observable to make it observable.
The text was updated successfully, but these errors were encountered: