mobx 5.13.1 → 5.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/api/action.d.ts +0 -0
- package/lib/api/actiondecorator.d.ts +0 -0
- package/lib/api/autorun.d.ts +5 -0
- package/lib/api/become-observed.d.ts +0 -0
- package/lib/api/computed.d.ts +0 -0
- package/lib/api/configure.d.ts +10 -0
- package/lib/api/decorate.d.ts +0 -0
- package/lib/api/extendobservable.d.ts +0 -0
- package/lib/api/extras.d.ts +0 -0
- package/lib/api/flow.d.ts +0 -0
- package/lib/api/intercept-read.d.ts +0 -0
- package/lib/api/intercept.d.ts +0 -0
- package/lib/api/iscomputed.d.ts +0 -0
- package/lib/api/isobservable.d.ts +0 -0
- package/lib/api/object-api.d.ts +0 -0
- package/lib/api/observable.d.ts +0 -0
- package/lib/api/observabledecorator.d.ts +0 -0
- package/lib/api/observe.d.ts +0 -0
- package/lib/api/tojs.d.ts +0 -0
- package/lib/api/trace.d.ts +0 -0
- package/lib/api/transaction.d.ts +0 -0
- package/lib/api/when.d.ts +5 -0
- package/lib/core/action.d.ts +1 -0
- package/lib/core/atom.d.ts +0 -0
- package/lib/core/computedvalue.d.ts +0 -0
- package/lib/core/derivation.d.ts +7 -0
- package/lib/core/globalstate.d.ts +15 -0
- package/lib/core/observable.d.ts +0 -0
- package/lib/core/reaction.d.ts +2 -1
- package/lib/core/spy.d.ts +0 -0
- package/lib/internal.d.ts +0 -0
- package/lib/mobx.d.ts +0 -0
- package/lib/mobx.es6.js +303 -246
- package/lib/mobx.js +304 -246
- package/lib/mobx.js.flow +18 -0
- package/lib/mobx.min.js +1 -1
- package/lib/mobx.module.js +305 -247
- package/lib/mobx.umd.js +304 -246
- package/lib/mobx.umd.min.js +1 -1
- package/lib/types/dynamicobject.d.ts +0 -0
- package/lib/types/intercept-utils.d.ts +0 -0
- package/lib/types/listen-utils.d.ts +0 -0
- package/lib/types/modifiers.d.ts +0 -0
- package/lib/types/observablearray.d.ts +0 -0
- package/lib/types/observablemap.d.ts +0 -0
- package/lib/types/observableobject.d.ts +0 -0
- package/lib/types/observableset.d.ts +0 -0
- package/lib/types/observablevalue.d.ts +0 -0
- package/lib/types/type-utils.d.ts +0 -0
- package/lib/utils/comparer.d.ts +0 -0
- package/lib/utils/decorators.d.ts +0 -0
- package/lib/utils/eq.d.ts +0 -0
- package/lib/utils/iterable.d.ts +0 -0
- package/lib/utils/utils.d.ts +0 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
# 5.
|
|
1
|
+
# 5.14.0 / 4.14.0
|
|
2
|
+
|
|
3
|
+
* Added experimental `reactionRequiresObservable` & `observableRequiresReaction` config [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)
|
|
4
|
+
* Added experimental `requiresObservable` config to `reaction`, `autorun` & `when` options [#2079](https://github.com/mobxjs/mobx/pull/2079), [Docs](https://github.com/mobxjs/mobx/pull/2082)
|
|
5
|
+
|
|
6
|
+
# 5.13.1 / 4.13.1
|
|
2
7
|
|
|
3
8
|
* Don't use `global` and `self` keywords unless defined. Fixes [#2070](https://github.com/mobxjs/mobx/issues/2070).
|
|
4
9
|
* onBecome(Un)Observed didn't trigger when using number as key of observable map. Fixes [#2067](https://github.com/mobxjs/mobx/issues/2067).
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/lib/api/action.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/api/autorun.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { IEqualsComparer, IReactionDisposer, IReactionPublic } from "../internal
|
|
|
2
2
|
export interface IAutorunOptions {
|
|
3
3
|
delay?: number;
|
|
4
4
|
name?: string;
|
|
5
|
+
/**
|
|
6
|
+
* Experimental.
|
|
7
|
+
* Warns if the view doesn't track observables
|
|
8
|
+
*/
|
|
9
|
+
requiresObservable?: boolean;
|
|
5
10
|
scheduler?: (callback: () => void) => any;
|
|
6
11
|
onError?: (error: any) => void;
|
|
7
12
|
}
|
|
File without changes
|
package/lib/api/computed.d.ts
CHANGED
|
File without changes
|
package/lib/api/configure.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
export declare function configure(options: {
|
|
2
2
|
enforceActions?: boolean | "strict" | "never" | "always" | "observed";
|
|
3
3
|
computedRequiresReaction?: boolean;
|
|
4
|
+
/**
|
|
5
|
+
* (Experimental)
|
|
6
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
7
|
+
*/
|
|
8
|
+
reactionRequiresObservable?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* (Experimental)
|
|
11
|
+
* Warn if observables are accessed outside a reactive context
|
|
12
|
+
*/
|
|
13
|
+
observableRequiresReaction?: boolean;
|
|
4
14
|
computedConfigurable?: boolean;
|
|
5
15
|
isolateGlobalState?: boolean;
|
|
6
16
|
disableErrorBoundaries?: boolean;
|
package/lib/api/decorate.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/api/extras.d.ts
CHANGED
|
File without changes
|
package/lib/api/flow.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/api/intercept.d.ts
CHANGED
|
File without changes
|
package/lib/api/iscomputed.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/api/object-api.d.ts
CHANGED
|
File without changes
|
package/lib/api/observable.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/api/observe.d.ts
CHANGED
|
File without changes
|
package/lib/api/tojs.d.ts
CHANGED
|
File without changes
|
package/lib/api/trace.d.ts
CHANGED
|
File without changes
|
package/lib/api/transaction.d.ts
CHANGED
|
File without changes
|
package/lib/api/when.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { IReactionDisposer, Lambda } from "../internal";
|
|
|
2
2
|
export interface IWhenOptions {
|
|
3
3
|
name?: string;
|
|
4
4
|
timeout?: number;
|
|
5
|
+
/**
|
|
6
|
+
* Experimental.
|
|
7
|
+
* Warns if the view doesn't track observables
|
|
8
|
+
*/
|
|
9
|
+
requiresObservable?: boolean;
|
|
5
10
|
onError?: (error: any) => void;
|
|
6
11
|
}
|
|
7
12
|
export declare function when(predicate: () => boolean, opts?: IWhenOptions): Promise<void> & {
|
package/lib/core/action.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function executeAction(actionName: string, fn: Function, scope?:
|
|
|
7
7
|
export interface IActionRunInfo {
|
|
8
8
|
prevDerivation: IDerivation | null;
|
|
9
9
|
prevAllowStateChanges: boolean;
|
|
10
|
+
prevAllowStateReads: boolean;
|
|
10
11
|
notifySpy: boolean;
|
|
11
12
|
startTime: number;
|
|
12
13
|
error?: any;
|
package/lib/core/atom.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/core/derivation.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface IDerivation extends IDepTreeNode {
|
|
|
30
30
|
__mapid: string;
|
|
31
31
|
onBecomeStale(): void;
|
|
32
32
|
isTracing: TraceMode;
|
|
33
|
+
/**
|
|
34
|
+
* warn if the derivation has no dependencies after creation/update
|
|
35
|
+
*/
|
|
36
|
+
requiresObservable?: boolean;
|
|
33
37
|
}
|
|
34
38
|
export declare class CaughtException {
|
|
35
39
|
cause: any;
|
|
@@ -50,6 +54,7 @@ export declare function isCaughtException(e: any): e is CaughtException;
|
|
|
50
54
|
export declare function shouldCompute(derivation: IDerivation): boolean;
|
|
51
55
|
export declare function isComputingDerivation(): boolean;
|
|
52
56
|
export declare function checkIfStateModificationsAreAllowed(atom: IAtom): void;
|
|
57
|
+
export declare function checkIfStateReadsAreAllowed(observable: IObservable): void;
|
|
53
58
|
/**
|
|
54
59
|
* Executes the provided function `f` and tracks which observables are being accessed.
|
|
55
60
|
* The tracking information is stored on the `derivation` object and the derivation is registered
|
|
@@ -60,6 +65,8 @@ export declare function clearObserving(derivation: IDerivation): void;
|
|
|
60
65
|
export declare function untracked<T>(action: () => T): T;
|
|
61
66
|
export declare function untrackedStart(): IDerivation | null;
|
|
62
67
|
export declare function untrackedEnd(prev: IDerivation | null): void;
|
|
68
|
+
export declare function allowStateReadsStart(allowStateReads: boolean): boolean;
|
|
69
|
+
export declare function allowStateReadsEnd(prev: boolean): void;
|
|
63
70
|
/**
|
|
64
71
|
* needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0
|
|
65
72
|
*
|
|
@@ -55,6 +55,11 @@ export declare class MobXGlobals {
|
|
|
55
55
|
* To ensure that those functions stay pure.
|
|
56
56
|
*/
|
|
57
57
|
allowStateChanges: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Is it allowed to read observables at this point?
|
|
60
|
+
* Used to hold the state needed for `observableRequiresReaction`
|
|
61
|
+
*/
|
|
62
|
+
allowStateReads: boolean;
|
|
58
63
|
/**
|
|
59
64
|
* If strict mode is enabled, state changes are by default not allowed
|
|
60
65
|
*/
|
|
@@ -73,6 +78,16 @@ export declare class MobXGlobals {
|
|
|
73
78
|
* Warn if computed values are accessed outside a reactive context
|
|
74
79
|
*/
|
|
75
80
|
computedRequiresReaction: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* (Experimental)
|
|
83
|
+
* Warn if you try to create to derivation / reactive context without accessing any observable.
|
|
84
|
+
*/
|
|
85
|
+
reactionRequiresObservable: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* (Experimental)
|
|
88
|
+
* Warn if observables are accessed outside a reactive context
|
|
89
|
+
*/
|
|
90
|
+
observableRequiresReaction: boolean;
|
|
76
91
|
/**
|
|
77
92
|
* Allows overwriting of computed properties, useful in tests but not prod as it can cause
|
|
78
93
|
* memory leaks. See https://github.com/mobxjs/mobx/issues/1867
|
package/lib/core/observable.d.ts
CHANGED
|
File without changes
|
package/lib/core/reaction.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class Reaction implements IDerivation, IReactionPublic {
|
|
|
29
29
|
name: string;
|
|
30
30
|
private onInvalidate;
|
|
31
31
|
private errorHandler?;
|
|
32
|
+
requiresObservable: boolean;
|
|
32
33
|
observing: IObservable[];
|
|
33
34
|
newObserving: IObservable[];
|
|
34
35
|
dependenciesState: IDerivationState;
|
|
@@ -41,7 +42,7 @@ export declare class Reaction implements IDerivation, IReactionPublic {
|
|
|
41
42
|
_isTrackPending: boolean;
|
|
42
43
|
_isRunning: boolean;
|
|
43
44
|
isTracing: TraceMode;
|
|
44
|
-
constructor(name: string, onInvalidate: () => void, errorHandler?: ((error: any, derivation: IDerivation) => void) | undefined);
|
|
45
|
+
constructor(name: string, onInvalidate: () => void, errorHandler?: ((error: any, derivation: IDerivation) => void) | undefined, requiresObservable?: boolean);
|
|
45
46
|
onBecomeStale(): void;
|
|
46
47
|
schedule(): void;
|
|
47
48
|
isScheduled(): boolean;
|
package/lib/core/spy.d.ts
CHANGED
|
File without changes
|
package/lib/internal.d.ts
CHANGED
|
File without changes
|
package/lib/mobx.d.ts
CHANGED
|
File without changes
|