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: MobX 5 #1380

Closed
wants to merge 197 commits into from
Closed
Show file tree
Hide file tree
Changes from 170 commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
2f27d32
Cleanup
mweststrate Mar 8, 2018
29c4e1f
Some cleanup
mweststrate Mar 8, 2018
ff6640a
Some cleanup
mweststrate Mar 8, 2018
ed05d20
More cleanup!
mweststrate Mar 8, 2018
5ea2505
Cleaning up
mweststrate Mar 8, 2018
c719720
An initial proxy based array implementation
mweststrate Mar 8, 2018
c95ea23
All unit tests pass now
mweststrate Mar 9, 2018
424c006
small stuff
mweststrate Mar 9, 2018
dee8d24
Added some TODO's
mweststrate Mar 10, 2018
b97dbd7
Restructured, to prepare for proxy based objects
mweststrate Mar 11, 2018
e935b52
Proxied objects kinda working
mweststrate Mar 11, 2018
32dfb0e
TODO's
mweststrate Mar 12, 2018
1090a2c
Merge branch 'mobx4'
mweststrate Mar 12, 2018
1bbcac3
Published version 4.0.0
mweststrate Mar 12, 2018
ef9ffb9
Removed jsfiddle link
mweststrate Mar 12, 2018
1f04e8b
Fixed flow typings (#1392)
Mar 12, 2018
e8b230b
TODOS
mweststrate Mar 12, 2018
7bb3f14
Added something missing from the CHANGELOG
Mar 12, 2018
b68df65
Merge pull request #1393 from andrew--r/master
mweststrate Mar 13, 2018
6d8c6af
Merge pull request #1394 from jjinux/changelog-observable-computed-get
mweststrate Mar 13, 2018
6f7dc09
Published version 4.0.1
mweststrate Mar 13, 2018
2dc4f1d
Minor fix for flow typing
Mar 13, 2018
9d8a725
Fix typo in the changelog
jdreesen Mar 13, 2018
562030b
Fix some more typos in the changelog
jdreesen Mar 13, 2018
0d73fdd
Added tests to verify that arrays are still spreadable / not concat s…
mweststrate Mar 14, 2018
94a8882
Merge pull request #1400 from jdreesen/patch-1
mweststrate Mar 14, 2018
ea47438
Merge pull request #1399 from ismailhabib/master
mweststrate Mar 14, 2018
6e50585
Removed debugger statements
mweststrate Mar 14, 2018
4b44c32
Fixed object initialization issue
mweststrate Mar 14, 2018
266764d
Published version 4.0.2
mweststrate Mar 14, 2018
b2a4a9c
Make actions reconfigurable, fixes #1398
mweststrate Mar 14, 2018
a78998a
Fixed #1398; `@computed` properties not working in RN components
mweststrate Mar 15, 2018
e6363ad
Correct issue nr is #1396
mweststrate Mar 15, 2018
25f2fed
Updated sponsors list
mweststrate Mar 15, 2018
18ad1d9
All observable api's now default to `any` for their generic arguments
mweststrate Mar 15, 2018
037020d
Introduced `keepAlive` option on computed.
mweststrate Mar 15, 2018
b7fec6e
Slightly faster observable initialization
mweststrate Mar 15, 2018
5e230c2
Added test demonstrating tuples, see #1391
mweststrate Mar 15, 2018
aa2f558
Fixed potentially runaway promise when cancelling the flow generator
mweststrate Mar 15, 2018
f1c45e2
Added tests verifying #1413
mweststrate Mar 15, 2018
02c0994
Implemented #1402: run when effect in action
mweststrate Mar 15, 2018
5fb127c
Updated changelog
mweststrate Mar 15, 2018
84d4f0f
Merge pull request #1412 from mobxjs/fix-rn-decorators
mweststrate Mar 15, 2018
3e07bcb
Merge pull request #1407 from mobxjs/make-actions-reconfigurable
mweststrate Mar 15, 2018
7b7d6a7
Merge branch 'master' into random-improvements
mweststrate Mar 15, 2018
c9bb570
Merge pull request #1414 from mobxjs/random-improvements
mweststrate Mar 15, 2018
1cd8e7b
Test fixups
mweststrate Mar 15, 2018
8cccd93
Published version 4.1.0
mweststrate Mar 15, 2018
67c1854
docs: fix typo
NoNameProvided Mar 17, 2018
cf1eee2
Update README.md
forki Mar 20, 2018
d8ff405
Updated sponsors
mweststrate Mar 22, 2018
8d63071
Making a flaky test less flaky
mweststrate Mar 22, 2018
b96f623
Attempts 2
mweststrate Mar 22, 2018
a834549
doh
mweststrate Mar 22, 2018
eb13572
Attempt 3
mweststrate Mar 22, 2018
057df95
sponsor update
mweststrate Mar 22, 2018
39710dc
Added todo
mweststrate Mar 22, 2018
c71ee1d
Decorate: Fix in type-checked JS, resolves #1448
nykula Mar 23, 2018
460ada2
Flow-typed: add missing runInAction declaration
AMilassin Mar 23, 2018
052bc55
Merge pull request #1451 from AMilassin/patch-2
mweststrate Mar 26, 2018
e9b497f
Merge pull request #1438 from forki/patch-1
mweststrate Mar 27, 2018
e2cc3b3
Merge pull request #1430 from NoNameProvided/patch-1
mweststrate Mar 27, 2018
8562e77
Merge pull request #1450 from makepost/master
mweststrate Mar 27, 2018
1f88a64
More proxy tests
mweststrate Mar 27, 2018
8e13259
More tests
mweststrate Mar 27, 2018
bee2ac3
Better tests
mweststrate Mar 27, 2018
5855bd3
Implemetnation improvements
mweststrate Mar 27, 2018
b0fcdc1
spy: stop listen from handler test
farwayer Mar 27, 2018
647c3d5
spy: fix stop listen from handler
farwayer Mar 27, 2018
a380e75
Splitting out dynamic objects from static objects
mweststrate Mar 28, 2018
43779b8
Merge pull request #1460 from farwayer/spy-stop-fix
mweststrate Mar 28, 2018
f41dd51
Using the `default` export will no longer throw, but warn instead. Fi…
mweststrate Mar 28, 2018
a1a923b
Fixed an error message. Fixes #1418
mweststrate Mar 28, 2018
7ae8796
Updated changelog
mweststrate Mar 28, 2018
5e2a24c
Published version 4.1.1
mweststrate Mar 28, 2018
514802c
Tiny typo in Readme
stigi Mar 30, 2018
9ddc0ec
Merge pull request #1472 from stigi/patch-1
capaj Mar 31, 2018
464d0aa
add missing import of `fail`
mtaran-google Apr 7, 2018
f49fcbc
add another missing import of `fail`
mtaran-google Apr 7, 2018
102a2f1
Merge pull request #1482 from mtaran-google/patch-1
mweststrate Apr 9, 2018
6aee5e1
more test notes
mweststrate Apr 9, 2018
7179b96
Merge pull request #1483 from mtaran-google/patch-2
mweststrate Apr 9, 2018
e1de210
avoid the unnecessary reassign with the equivalent comparison result
kuitos Apr 13, 2018
cff477c
reword the test case description
kuitos Apr 13, 2018
a867c00
Fix Flow typing for observable.map
quanganhtran Apr 14, 2018
6f0bb9b
Update MobX 4 observable factories
quanganhtran Apr 14, 2018
dbef2ab
Add IObservableDecorator to Flow type
quanganhtran Apr 15, 2018
09493ee
Merge pull request #1501 from quanganhtran/master
mweststrate Apr 16, 2018
f6df576
Merge pull request #1499 from kuitos/fork-master
mweststrate Apr 16, 2018
2b00e62
Updated sponsors
mweststrate Apr 16, 2018
3ae4444
More flow typings
mweststrate Apr 16, 2018
394c418
Actions are now configurable again, fixes #1477
mweststrate Apr 16, 2018
b21b5e2
Implemented `Symbol.toStringTag` for observable arrays, fixes #1490
mweststrate Apr 16, 2018
52d1541
Undeprecated `ObservableMap`, fixes #1496
mweststrate Apr 16, 2018
8607ec3
Fixed #1480: exception in reaction effects where not handled correctl…
mweststrate Apr 16, 2018
b9ab050
Fixed test run issue
mweststrate Apr 16, 2018
d17e73c
Introduced `enforceActions: "strict"` mode, fixes #1473
mweststrate Apr 16, 2018
dbe4c93
Published version 4.2.0
mweststrate Apr 16, 2018
4ccf47c
Update object api set to write through parent mobx administrator
quanganhtran Apr 22, 2018
8844da2
Fix invariant check for ComputedValue constructor
quanganhtran Apr 22, 2018
8cca76d
Throw error in development when @observable is used on getters
quanganhtran Apr 21, 2018
7d167ef
refactor: replace the memorizer from array to ES6 map in mobx.tojs() &
loatheb Apr 23, 2018
2654cc1
Make `enforceActions` covariant (fixes #1520)
Apr 24, 2018
91c2ea4
Merge pull request #1521 from andrew--r/patch-1
mweststrate Apr 26, 2018
10fca42
Merge pull request #1515 from quanganhtran/invariant-fix
mweststrate Apr 26, 2018
be5eb38
Merge pull request #1514 from quanganhtran/observe-set
mweststrate Apr 26, 2018
6b50a8c
Merge pull request #1517 from loatheb/refactor-tojs
mweststrate May 3, 2018
b0ee838
Merge pull request #1511 from quanganhtran/master
mweststrate May 3, 2018
88aa33b
Added test verifying #1528
mweststrate May 3, 2018
37162c0
Fixed typings of flow, fixes #1527
mweststrate May 3, 2018
e9152bd
Added test to verify #1524
mweststrate May 3, 2018
fab6f75
Changed illegal access error to a warning
AmazingTurtle May 4, 2018
e61e8c9
Updated test for illegal access in observable object
AmazingTurtle May 4, 2018
8fb2861
v241
mweststrate May 4, 2018
45b4abc
add entries method to observable object api
May 8, 2018
6ec3907
add specs for the new entries method
May 8, 2018
d9d8ef4
export entries from mobx.ts
May 8, 2018
b16b738
Fix typos in README
hectorj May 9, 2018
9fdfa8c
Merge pull request #1540 from hectorj/patch-1
mweststrate May 9, 2018
09feab1
Simpler proxy object implementation (?)
mweststrate May 14, 2018
e421854
Merge branch 'master' into mobx5
mweststrate May 14, 2018
ed0d15c
Fixed issue where set from computed options wasn't picke dup
mweststrate May 14, 2018
b0371bf
Fixed #1545: actions not reassignable when using typescript
mweststrate May 14, 2018
109eaf4
all tests are passing!
mweststrate May 18, 2018
ac79559
Merge pull request #1529 from AmazingTurtle/patch-1
mweststrate May 22, 2018
524045d
Merge pull request #1536 from samjacobclift/entries-method-for-observ…
mweststrate May 22, 2018
10572e0
updated sponsors
mweststrate May 22, 2018
4b08f12
Improved typings / impl for `entries()`
mweststrate May 22, 2018
cf38655
Fixed compile / test issues
mweststrate May 22, 2018
a5f5793
Reproduced and fixed #1535
mweststrate May 22, 2018
d40b258
Slightly better handling of #1506
mweststrate May 22, 2018
5a78e6d
Updated changelog
mweststrate May 22, 2018
20aab7c
Published version 4.3.0
mweststrate May 22, 2018
79f33ee
Merge branch 'master' into mobx5
mweststrate May 22, 2018
e7e6e8d
Improvements
mweststrate May 23, 2018
fcc738f
observable objects have no more map like semantics: listen for the ad…
mweststrate May 23, 2018
d0184e1
Code cleanup / optimization
mweststrate May 23, 2018
098b0c9
Removed all deprecated methods
mweststrate May 23, 2018
d4f5302
Cleaned up test output
mweststrate May 23, 2018
1786bdc
Processed bunch of TODO's
mweststrate May 24, 2018
6fcb5ae
$mobx is now a symbol
mweststrate May 24, 2018
5d2d9b0
make sure object keys are always strings
mweststrate May 24, 2018
2c3d4ee
Use symbols for decorators
mweststrate May 24, 2018
75a07e4
Some cleanup
mweststrate May 24, 2018
cb61e2d
Fixed some compile warnings
mweststrate May 24, 2018
d631139
Use Sets to store observers collection, reducing memory foodprint and…
mweststrate May 24, 2018
12b5c0e
More efficient map implementation
mweststrate May 24, 2018
62e006e
Some invariant clean up that wasn't too useful
mweststrate May 24, 2018
ac9d38f
Observable objects are now backed by maps, slightly more efficient
mweststrate May 24, 2018
eaab014
Removed `spy` from production builds
mweststrate May 24, 2018
bfb0f63
Dropped observableArray.peek(), made .slice() implementation faster
mweststrate May 24, 2018
a4b7354
Some more code cleanup
mweststrate May 24, 2018
047f168
Fixed some compile errors
mweststrate May 24, 2018
b263c43
beta1
mweststrate May 24, 2018
cdc8fd9
Fine tuning proxies, more tests
mweststrate May 25, 2018
bb19bc1
Oops, slice was broken..
mweststrate May 25, 2018
778a587
Optimized array built-ins
mweststrate May 25, 2018
7c96b62
MobX now ships as ES6 package
mweststrate May 25, 2018
ca1adb5
cleanup inheritance workaround
mweststrate May 25, 2018
5a43e56
WIP
mweststrate May 25, 2018
1ca32f5
WIP
mweststrate May 25, 2018
e7f32aa
To single module import
mweststrate May 25, 2018
86b500d
fixed some circular issue problems
mweststrate May 25, 2018
4bc864d
Merge branch 'uncircular' into mobx5
mweststrate May 25, 2018
3d35567
Fixed build issue
mweststrate May 25, 2018
bfbe0c2
@computed({keepAlive: true}) no long calculates before being accessed
hector May 25, 2018
c572d10
adds Browser support section to the main readme
capaj May 26, 2018
a5dee3a
Remove redundant code
fecqs May 27, 2018
b1d8b97
Fixed potential issue in untracked
mweststrate May 28, 2018
e9d8760
fixed travis issue
mweststrate May 28, 2018
e794a2c
More tests, better changelog, added `in` trap
mweststrate May 28, 2018
7098bd2
Merge pull request #1564 from JSlife23/master
mweststrate May 28, 2018
841e586
Tests to verify #1567
mweststrate Jun 4, 2018
68084ad
Jest does not place nice with toEqual and symbols
mweststrate Jun 4, 2018
faf4bb8
Some additional tests to verify interaction with jest
mweststrate Jun 4, 2018
de76c56
Added MobX 5 forward compatibility
mweststrate Jun 4, 2018
b54e03b
Published version 4.3.1
mweststrate Jun 4, 2018
1be3976
Merge pull request #1562 from mobxjs/capaj-readme-patch-1
mweststrate Jun 4, 2018
495a45b
Merge branch 'master' into compued-keepAlive
mweststrate Jun 4, 2018
4f6ec32
Merge pull request #1560 from hector/compued-keepAlive
mweststrate Jun 4, 2018
1547199
Upgraded to TypeScript 2.9
mweststrate Jun 5, 2018
b5e60e7
Processed some review comments
mweststrate Jun 5, 2018
41c124b
fix typo in readme
capaj Jun 5, 2018
e66b1ad
bug: allow changing while observable array initialization
kuitos Jun 5, 2018
c405059
Notes about Jest in the changelog
mweststrate Jun 5, 2018
b3a43b3
Downgraded node version for travis
mweststrate Jun 5, 2018
37d6abc
Somehow travis keeps using uglifyjs instead of uglify-es
mweststrate Jun 5, 2018
445f7c0
'Fixed test
mweststrate Jun 5, 2018
a27b849
Using `observableArray.reverse` or `sort` now prints a warning about …
mweststrate Jun 5, 2018
b05c2df
Make sure `action.bound` uses the proxy as `this` if available
mweststrate Jun 5, 2018
c53f8be
Improved changelog
mweststrate Jun 5, 2018
9aace8f
Fixed computed values not receiving proxy as this
mweststrate Jun 5, 2018
f695dae
Better reuse, small optimizations
mweststrate Jun 5, 2018
405a025
Merge pull request #1573 from kuitos/master
mweststrate Jun 5, 2018
e10dbda
Merge remote-tracking branch 'origin/master' into mobx5
mweststrate Jun 5, 2018
5b8ba54
fixed peformance test
mweststrate Jun 5, 2018
e17c478
Improved changelog & readme
mweststrate Jun 7, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ script: CI=true yarn test:travis
after_success:
- cat ./coverage/lcov.info|./node_modules/coveralls/bin/coveralls.js
node_js:
- 6
- 9.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

10?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

addons:
apt:
packages:
Expand Down
102 changes: 96 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,94 @@
# 5.0.0

# Improvements

* uses & requires proxies. otherwise use mobx 4
* observable objects created with `observable({...})` support dynamically adding keys
- arrays are now spreadable and such

# Breaking

* The minimum runtime target is now ES2015, not ES5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea: what about using preset-env with well defined and published browserlist,
And advise users that need to support older browser to pass it thru babel again with different browserlist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not familiar with preset-env. How would that work / what does it do?

Copy link

@tkrotoff tkrotoff Jun 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mweststrate check https://github.com/tkrotoff/babel-preset-env-example and babel/website#1660

To sum up, babel-preset-env automagically only includes the polyfills and babel plugins needed for a given list of targeted browsers (browsers: ['> 1% in FR']).

Edit: Babel 7 gives even more magic thx to useBuiltIns: usage

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you also have granularity of last 2 major versions of edge, chrome, safari, and so

* `spy` is a no-op in production builds
* all deprecated api's are dropped. Make sure to not have any deprecation warnings before upgrading
* dropped `array.move` and `array.peek`
* dropped third arg to `array.find` and `array.findIndex` (not in standard)
* `proxy: false` argument to `observable.object` to disable proxying (faster, but no dynamic key support)
* `.$mobx` property has been dropped from all observables and replaced by a Symbol. Instead of e.g. `x.$mobx.name`, use `import { $mobx } from "mobx"; x[$mobx].name`
* in some cases, the order in which autoruns are fired could have changed due to some internal optimizations (note that MobX never had a guarantee about the order in which autoruns fired!)

Proxies
- caveats: prebound methods `this` ain't the proxy!

Caveat: Jest `toEqual` matcher might no longer play nicely with your class instances, due to a bug with the processing of symbols: https://github.com/facebook/jest/issues/6392. For now you might want to use a custom matcher if you are directly equalling observable objects.

# 4.3.0

* Introduced the `entries(observable)` API, by @samjacobclift through [#1536](https://github.com/mobxjs/mobx/pull/1536)
* Fixed [#1535](https://github.com/mobxjs/mobx/issues/1535): Change in nested computed value was not propagated if read outside action context when there is a pending reaction. For more details see the exact test case.
* Illegal property access through prototypes is now a warning instead of an error. Fixes [#1506](https://github.com/mobxjs/mobx/issues/1506). By @AmazingTurtle through [#1529](https://github.com/mobxjs/mobx/pull/1529)
* Fixed issue where providing a custom setter to `@computed({ set: ... })` wasn't picked up
* Fixed #1545: Actions properties where not re-assignable when using TypeScript
* Illegal Access checks are now a warning instead of an error. Fix

# 4.2.1

* Fixed flow typings for `mobx.configure` [#1521](https://github.com/mobxjs/mobx/pull/1521) by @andrew--r
* Improved typings for `mobx.flow`, fixes [#1527](https://github.com/mobxjs/mobx/issues/1527)
* Throw error when using `@observable` in combination with a getter. [#1511](https://github.com/mobxjs/mobx/pull/1511) by @quanganhtran
* `toJS` now uses Map internally, for faster detection of cycles. [#1517](https://github.com/mobxjs/mobx/pull/1517) by @loatheb
* Fixed [#1512](https://github.com/mobxjs/mobx/issues/1512): `observe` hooks not being triggered when using `mobx.set`, Fixed in [#1514](https://github.com/mobxjs/mobx/pull/1514) by @quanganhtran
* Several minor improvements, additional tests and doc improvements.

# 4.2.0

* Introduced `configure({ enforceActions: "strict" })`, which is more strict then `enforceActions: true`, as it will also throw on non-observed changes to observables. See also [#1473](https://github.com/mobxjs/mobx/issues/1473)
* Fixed [#1480](https://github.com/mobxjs/mobx/issues/1480): Exceptions in the effect handler of `reaction` where not properly picked up by the global reaction system
* Fixed a bug where computed values updated their cached value, even when the comparer considered the new value equal to the previous one. Thanks @kuitos for finding this and fixing it! [#1499](https://github.com/mobxjs/mobx/pull/1499)
* Undeprecated `ObservableMap`, fixes [#1496](https://github.com/mobxjs/mobx/issues/1496)
* Observable arrays now support `Symbol.toStringTag` (if available / polyfilled). This allows libraries like Ramda to detect automatically that observable arrays are arrays. Fixes [#1490](https://github.com/mobxjs/mobx/issues/1490). Note that `Array.isArray` will keep returning false for the entire MobX 4 range.
* Actions are now always `configurable` and `writable`, like in MobX 3. Fixes [#1477](https://github.com/mobxjs/mobx/issues/1477)
* Merged several improvements to the flow typings. [#1501](https://github.com/mobxjs/mobx/pull/1501) by @quanganhtran
* Fixed several accidental usages of the global `fail`, by @mtaran-google through [#1483](https://github.com/mobxjs/mobx/pull/1483) and [#1482](https://github.com/mobxjs/mobx/pull/1482)

# 4.1.1

* Import `default` from MobX will no longer throw, but only warn instead. This fixes some issues with tools that reflect on the `default` export of a module.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line ends with a dot but other lines do not

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

* Disposing a spy listener inside a spy handler no longer causes an exception. Fixes [#1459](https://github.com/mobxjs/mobx/issues/1459) through [#1460](https://github.com/mobxjs/mobx/pull/1460) by [farwayer](https://github.com/farwayer)
* Added a missing `runInAction` overload in the flow typings. [#1451](https://github.com/mobxjs/mobx/pull/1451) by [AMilassin](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3AAMilassin)
* Improved the typings of `decorate`. See [#1450](https://github.com/mobxjs/mobx/pull/1450) by [makepost](https://github.com/mobxjs/mobx/issues?q=is%3Apr+author%3Amakepost)

# 4.1.0

* Introduced `keepAlive` as option to `computed`
* All observable api's now default to `any` for their generic arguments
* Improved `flow` cancellation
* The effect of `when` is now automatically an action.
* `@computed` properties are now declared on their owner rather then the protoptype. Fixes an issue where `@computed` fields didn't work in React Native on proxied objects. See [#1396](https://github.com/mobxjs/mobx/issues/1396)
* `action` and `action.bound` decorated fields are now reassignable, so that they can be stubbed

# 4.0.2

* Fixed issue where exceptions like `TypeError: Cannot define property:__mobxDidRunLazyInitializers, object is not extensible.` were thrown. Fixes [#1404](https://github.com/mobxjs/mobx/issues/1404)
* Improved flow typings for `flow`, [#1399](https://github.com/mobxjs/mobx/pull/1399) by @ismailhabib

# 4.0.1

* Updated flow typings, see [#1393](https://github.com/mobxjs/mobx/pull/1393) by [andrew--r](https://github.com/andrew--r)

# 4.0.0

* For the highlights of this release, read the [blog](https://medium.com/p/c1fbc08008da/):
* For migration notes: see the [wiki page](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)
* Note; many things that were removed were removed to make the api surface smaller. If you thing some feature shouldn't have been removed, feel free to open an issue!
* Note; many things that were removed to make the api surface smaller. If you think some feature shouldn't have been removed, feel free to open an issue!

This is the extensive list of all changes.

### New features

The changes mentioned here are discussed in detail in the [release highlights](https://medium.com/p/c1fbc08008da/), or were simply updated in the docs.

* MobX 4 introduces separation between the production and non production build. The production build strips most typechecks, resulting in a faster and smaller build. Make sure to substitute process.env.NODE_ENV = "production" in your build process! If you are using MobX in a react project, you most probably already have set this up. Otherwise, they idea is explained [here](https://reactjs.org/docs/add-react-to-an-existing-app.html).
* MobX 4 introduces separation between the production and non production build. The production build strips most typechecks, resulting in a faster and smaller build. Make sure to substitute process.env.NODE_ENV = "production" in your build process! If you are using MobX in a react project, you most probably already have set this up. Otherwise, the idea is explained [here](https://reactjs.org/docs/add-react-to-an-existing-app.html).
* Introduced `flow` to create a chain of async actions. This is the same function as [`asyncActions`](https://github.com/mobxjs/mobx-utils#asyncaction) of the mobx-utils package
* These `flow`'s are now cancellable, by calling `.cancel()` on the returned promise, which will throw a cancellation exception into the generator function.
* `flow` also has experimental support for async iterators (`async * function`)
Expand All @@ -26,19 +104,19 @@ The changes mentioned here are discussed in detail in the [release highlights](h
* `computed(fn, options?)` / `@computed(options) get fn()` now accept the following options:
* `set: (value) => void` to set a custom setter on the computed property
* `name: "debug name"`
* `equals: fn` the equality value to use for the computed to determine whether it's output has changed. The default is `comparer.default`. Alternatives are `comparer.structural`, `comparer.identity` or just your own comparison function.
* `equals: fn` the equality value to use for the computed to determine whether its output has changed. The default is `comparer.default`. Alternatives are `comparer.structural`, `comparer.identity` or just your own comparison function.
* `requiresReaction: boolean` see above.

* `autorun(fn, options?)` now accepts the following options:
* `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`
* `name: "debug name"
* `name: "debug name"`
* `scheduler: function` a custom scheduler to run the autorun. For example to connect running the autorun to `requestAnimationFrame`. See the docs for more details
* `onError`. A custom error handler to be notified when an autorun throws an exception.

* `reaction(expr, effect, options?)` now accepts the following options:
* `delay: number` debounce the autorun with the given amount of milliseconds. This replaces the MobX 3 api `autorunAsync`
* `fireImmediately`. Immediately fire the effect function after the first evaluation of `expr`
* `equals`. Custom equality function to determine whether the `expr` function differed from it's previous result, and hence should fire `effect`. Accepts the same options as the `equals` option of computed.
* `equals`. Custom equality function to determine whether the `expr` function differed from its previous result, and hence should fire `effect`. Accepts the same options as the `equals` option of computed.
* All the options `autorun` accepts

* `when(predicate, effect?, options?)` now accepts the following options:
Expand Down Expand Up @@ -66,7 +144,7 @@ The changes mentioned here are discussed in detail in the [release highlights](h
The changes mentioned here are discussed in detail in the [migration notes](https://github.com/mobxjs/mobx/wiki/Migrating-from-mobx-3-to-mobx-4)

* MobX 4 requires `Map` to be globally available. Polyfill it if targeting IE < 11 or other older browsers.
* For typescript users, MobX now requires `Map` and several `Symbol`s to exist for it's typings. So make sure that the `lib` configuration of your project is set to `"es6"`. (The compilation target can still be `"es5"`)
* For typescript users, MobX now requires `Map` and several `Symbol`s to exist for its typings. So make sure that the `lib` configuration of your project is set to `"es6"`. (The compilation target can still be `"es5"`)
* `observable.shallowArray(values)` has been removed, instead use `observable.array(values, { deep: false })`
* `observable.shallowMap(values)` has been removed, instead use `observable.map(values, { deep: false })`
* `observable.shallowObject(values)` has been removed, instead use `observable.object(values, {}, { deep: false })`
Expand Down Expand Up @@ -613,6 +691,18 @@ observable({
})
```

By the way, if you have code such as:

```
observable({
@computed get someProp() { ... }
});
```

That code will no longer work. Rather, reactions will fail silently. Remove `@computed`.
Note, this only applies when using observable in this way; it doesn't apply when using
`@observable` on a property within a class declaration.

### Misc

* Fixed #701: `toJS` sometimes failing to convert objects decorated with `@observable` (cause: `isObservable` sometimes returned false on these object)
Expand Down
2 changes: 0 additions & 2 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Welcome to MobX. Please provide as much relevant information as possible!

If at all possible, provide a **minimal** sample reproduction. **Create a minimal reproduction based on this [jsfiddle](https://jsfiddle.net/mweststrate/f0dptdau/2/)**

I have a:

1. [ ] Question: Feel free to just state your question. For a quick answer, there are usually people online at our [Gitter](https://gitter.im/mobxjs/mobx) channel
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ which includes the UI, data serialization, server communication, etc.

React and MobX together are a powerful combination. React renders the application state by providing mechanisms to translate it into a tree of renderable components. MobX provides the mechanism to store and update the application state that React then uses.

Both React and MobX provide very optimal and unique solutions to common problems in application development. React provides mechanisms to optimally render UI by using a virtual DOM that reduces the number of costly DOM mutations. MobX provides mechanisms to optimally synchronize application state with your React components by using a reactive virtual dependency state graph that is only updated when strictly needed and is never stale.
Both React and MobX provide optimal and unique solutions to common problems in application development. React provides mechanisms to optimally render UI by using a virtual DOM that reduces the number of costly DOM mutations. MobX provides mechanisms to optimally synchronize application state with your React components by using a reactive virtual dependency state graph that is only updated when strictly needed and is never stale.

## Core concepts

Expand Down Expand Up @@ -215,7 +215,7 @@ store.todos[0].finished = true;
```

Nonetheless, MobX has an optional built-in concept of [`actions`](https://mobxjs.github.io/mobx/refguide/action.html).
Read this section as well if you want to now more about writing asynchronous actions. It's easy!
Read this section as well if you want to know more about writing asynchronous actions. It's easy!
Use them to your advantage; they will help you to structure your code better and make wise decisions about when and where state should be modified.

## MobX: Simple and scalable
Expand All @@ -240,9 +240,9 @@ As demonstrated above, modifying state when using MobX is very straightforward.

MobX builds a graph of all the derivations in your application to find the least number of re-computations that is needed to prevent staleness. "Derive everything" might sound expensive, MobX builds a virtual derivation graph to minimize the number of recomputations needed to keep derivations in sync with the state.

In fact, when testing MobX at Mendix we found out that using this library to track the relations in our code is often a lot more efficient then pushing changes through our application by using handwritten events or "smart" selector based container components.
In fact, when testing MobX at Mendix we found out that using this library to track the relations in our code is often a lot more efficient than pushing changes through our application by using handwritten events or "smart" selector based container components.

The simple reason is that MobX will establish far more fine grained 'listeners' on your data then you would do as a programmer.
The simple reason is that MobX will establish far more fine grained 'listeners' on your data than you would do as a programmer.

Secondly MobX sees the causality between derivations so it can order them in such a way that no derivation has to run twice or introduces a glitch.

Expand Down
Loading