-
-
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
WIP: Mobx4 #1321
WIP: Mobx4 #1321
Conversation
…(value)` instead
CHANGELOG.md
Outdated
* Dropped bower support. Fixes #1263 | ||
* The `spyReportStart`, `spyReportEnd`, `spyReport` and `isSpyEnabled` are no longer public. It is no longer possible to emit custom spy events as to avoid confusing in listeners what the possible set of events is. | ||
* Dropped `isStrictModeEnabled` | ||
* `observable(value)` will only succeed if it can turn the value into an observable data structure (a Map, Array or observable object). But it will no longer create an observable box for other values to avoid confusion. Call `observable.box(value)` explictly in such cases. |
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.
Does this mean that @observable foo = 5
won't work anymore and we'd need to @observable.box foo = 5
?
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.
afaik this is just for the function API
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.
Good, I think @observable.box foo = 5
would be tedious to do every time since it's a pretty common use case for me to have observable value properties.
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.
@benjamingr correct, it is only for the function version, to make the result more predicatable (previously you would 'suddenly' get a box around your value if the value itself could not be made observable)
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.
Thanks @mweststrate, any update on using proxies for arrays? :D
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.
@benjamingr yes, after cleaning up everything in mobx 4, I will try to publish mobx 5, which is the same but with proxies in a foreseeable time
src/utils/utils.ts
Outdated
@@ -199,6 +181,10 @@ export function toPrimitive(value) { | |||
return value === null ? null : typeof value === "object" ? "" + value : value | |||
} | |||
|
|||
export function isThennable(thing: any): thing is PromiseLike<any> { |
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.
In general, it's preferable to not check if something is then
able if suspected but to Promise.resolve
it.
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.
Lol, committed this in the wrong branch.. :)
see #1076, #1316
Mobx 4
Fix strict type errorsskipped, it made the source less comprehensible, due to all the reflection an dynamic scoping of property descriptors etcextendObservable => extend nope: impactful without a lot of added valuekill modifiers? nope; used by manyuse boolean flags for all the internal states? Didn't gain enough to be interestinglegacy_observable
MobX 5
array.remove
and such?