Skip to content
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

Merged
merged 204 commits into from
Mar 12, 2018
Merged

WIP: Mobx4 #1321

merged 204 commits into from
Mar 12, 2018

Conversation

mweststrate
Copy link
Member

@mweststrate mweststrate commented Jan 25, 2018

see #1076, #1316

Mobx 4

MobX 5

  • Proxies!
  • Remove non-native utilities like array.remove and such?
  • Maps & Sets!

@mweststrate mweststrate mentioned this pull request Jan 25, 2018
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.
Copy link
Member

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?

Copy link

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

Copy link
Member

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.

Copy link
Member Author

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)

Copy link
Member

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

Copy link
Member Author

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

@@ -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> {
Copy link
Member

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 thenable if suspected but to Promise.resolve it.

Copy link
Member Author

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.. :)

@mweststrate mweststrate merged commit 298ce84 into master Mar 12, 2018
@danielkcz danielkcz deleted the mobx4 branch August 19, 2019 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants