All Versions
173
Latest Version
Avg Release Cycle
27 days
Latest Release
1047 days ago
Changelog History
Page 1
Changelog History
Page 1
-
v7.0.5 Changes
November 12, 2020 -
v7.0.4 Changes
November 07, 2020 -
v7.0.3 Changes
November 07, 2020 -
v7.0.2 Changes
November 06, 2020 -
v7.0.1 Changes
November 06, 2020 -
v6.0.4 Changes
November 12, 2020 -
v6.0.1 Changes
October 05, 2020- ๐ Fixed issue in TS typings of
makeObservable
in combination with a member namedtoString()
- ๐ Fixed issue in TS typings of
-
v6.0.0 Changes
September 30, 2020๐ New features
- ๐ [
makeObservable(target, annotations)
](./docs/observable-state.md#makeobservable) is now the recommended way to make objects with a fixed shape observable, such as classes. - ๐ [
makeAutoObservable(target)
](./docs/observable-state.md#makeautoobservable) will automatically determine the annotations used bymakeObservable
. Methods will be marked as 'autoAction', so that they can be used both from a computed value or as standalone method. - โฌ๏ธ MobX 6 can be used in both modern environments, and environments that don't support Proxy. So both MobX 4 and 5 users can upgrade to 6. See [proxy support](./docs/configuration.md#proxy-support) for more details.
- ๐
observable.array
now supports{ proxy: false }
as option. - ๐
reaction
's effect function now receives the previous value seen by the reaction as second argument. - ๐
flow
can now be used as annotation as well. You might needflowResult
in case you use TypeScript to extract the correct result type. [details](./docs/actions.md#using-flow-instead-of-async--await-).
๐ฅ Breaking changes
๐ Changes that might affect you
- ๐ The
decorate
API has been removed, and needs to be replaced bymakeObservable
in the constructor of the targeted class. It accepts the same arguments. Themobx-undecorate
can transform this automatically. - When using
extendObservable
/observable
, fields that contained functions used to be turned into observables. This is no longer the case, they will be converted intoautoActions
. - ๐ง [Strict mode](./docs/configuration.md#enforceactions) for actions is now enabled by default in
observed
mode. -
toJS
no longer takes any options. It no longer converts Maps and Sets to plain data structures. Generic, flexible serialization of data structures is out of scope for the MobX project, and writing custom serialization methods is a much more scalable approach to serialization (tip: leveragecomputed
s to define how class instances should be serialized). - The methods
intercept
andobserve
are no longer exposed on observable arrays, maps and boxed observables. Import them as utility from mobx instead:import { observe, intercept } from "mobx"
, and pass the collection as first argument:observer(collection, callback)
. Note that we still recommend to avoid these APIs. -
observableMap.toPOJO()
,observableMap.toJS()
have been dropped. Usenew Map(observableMap)
instead if you want to convert an observable map to a plain Map shallowly. - ๐
observableMap.toJSON()
now returns an entries array rather than a new Map, to better support serialization. -
observableSet.toJS()
has been dropped. Usenew Set(observableSet)
instead if you want to convert an observable Set to a plain Set shallowly. - ๐
observableSet.toJSON()
now returns an array rather than a new Set, to better support serialization. - Sorting or reversing an observableArray in a derivation (without slicing first) will now throw rather than warn. In contrast, it is now allowed to sort or reverse observable arrays in-place, as long as it happens in an action.
-
isArrayLike
is no longer exposed as utility. UseArray.isArray(x) || isObservableArray(x)
instead.
Obscure things that don't work anymore, but that probably won't affect you
- It is no longer possible to re-decorate a field (through either
@observable
ormakeObservable
) that is already declared in a super class. - ๐
runInAction
no longer supports passing a name as first argument. Name the original function or useaction(name, fn)()
if you care about the debug name. -
computed(getterFn, setterFn)
no longer accepts a setter function as a second argument. Use theset
option instead:computed(getterFn, { set: setterFn })
. - ๐ In observable arrays, for
findIndex
/find
method, theoffset
argument (the third one) is no longer supported, to be consistent with ES arrays. - ๐ง The option
computedConfigurable
ofconfigure
is no longer supported as it is now the default. - ๐
observableArray.toJS()
has been removed, useobservableArray.slice()
instead, which does the same. - Killed support for the
IGNORE_MOBX_MINIFY_WARNING
environment flag. -
_allowStateChangesInComputation(fn)
is no longer needed, userunInAction(fn)
instead. - In
computed
, thewhen
predicate (first arg), andreaction
predicate (first arg) it is now forbidden to directly change state. State changes should be done in their effect functions, or otherwise at least wrapped inrunInAction
(only the state change, not the observables you want to track!). Note that this is still an anti-pattern. - ๐ The
observableArray.get()
andobservableArray.set()
methods are no longer supported. - The
IObservableObject
interface is no longer exported from MobX. - ๐ The second argument to the
reaction
effect function, the disposer object, is now passed in as third argument. The second argument is now the previous value seen by the reaction. - ๐
onBecomeObserved
/onBecomeUnobserved
will now only trigger for observables that are actually used by a reaction (see #2309 for background).
๐ Fixes
- #2326: Incorrect
this
for array callbacks such as inarray.forEach
- ๐ #2379: Fixed issue with
array.concat
- ๐ #2309: Fixed several inconsistencies between keepAlive'd computed values and
on(un)BecomeObserved
- ๐ Fixed several inconsistencies when
on(un)BecomeObserved
was triggered for observables changed in actions without having an observer
- ๐ [