mobx 6.4.0 → 6.5.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 +18 -0
- package/dist/api/intercept.d.ts +1 -1
- package/dist/api/observe.d.ts +1 -1
- package/dist/core/reaction.d.ts +2 -2
- package/dist/mobx.cjs.development.js +1 -5
- package/dist/mobx.cjs.development.js.map +1 -1
- package/dist/mobx.cjs.production.min.js +1 -1
- package/dist/mobx.cjs.production.min.js.map +1 -1
- package/dist/mobx.esm.development.js +1 -5
- package/dist/mobx.esm.development.js.map +1 -1
- package/dist/mobx.esm.js +1 -5
- package/dist/mobx.esm.js.map +1 -1
- package/dist/mobx.esm.production.min.js +1 -1
- package/dist/mobx.esm.production.min.js.map +1 -1
- package/dist/mobx.umd.development.js +1 -5
- package/dist/mobx.umd.development.js.map +1 -1
- package/dist/mobx.umd.production.min.js +1 -1
- package/dist/mobx.umd.production.min.js.map +1 -1
- package/dist/types/observableset.d.ts +2 -2
- package/package.json +1 -1
- package/src/api/intercept.ts +1 -1
- package/src/api/observe.ts +1 -1
- package/src/core/derivation.ts +5 -1
- package/src/core/reaction.ts +2 -2
- package/src/types/observableset.ts +2 -2
|
@@ -37,8 +37,8 @@ export declare class ObservableSet<T = any> implements Set<T>, IInterceptable<IS
|
|
|
37
37
|
forEach(callbackFn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any): void;
|
|
38
38
|
get size(): number;
|
|
39
39
|
add(value: T): this;
|
|
40
|
-
delete(value:
|
|
41
|
-
has(value:
|
|
40
|
+
delete(value: T): boolean;
|
|
41
|
+
has(value: T): boolean;
|
|
42
42
|
entries(): IterableIterator<[T, T]>;
|
|
43
43
|
keys(): IterableIterator<T>;
|
|
44
44
|
values(): IterableIterator<T>;
|
package/package.json
CHANGED
package/src/api/intercept.ts
CHANGED
|
@@ -20,7 +20,7 @@ export function intercept<T>(
|
|
|
20
20
|
handler: IInterceptor<IValueWillChange<T>>
|
|
21
21
|
): Lambda
|
|
22
22
|
export function intercept<T>(
|
|
23
|
-
observableArray: IObservableArray<T>,
|
|
23
|
+
observableArray: IObservableArray<T> | Array<T>,
|
|
24
24
|
handler: IInterceptor<IArrayWillChange<T> | IArrayWillSplice<T>>
|
|
25
25
|
): Lambda
|
|
26
26
|
export function intercept<K, V>(
|
package/src/api/observe.ts
CHANGED
|
@@ -20,7 +20,7 @@ export function observe<T>(
|
|
|
20
20
|
fireImmediately?: boolean
|
|
21
21
|
): Lambda
|
|
22
22
|
export function observe<T>(
|
|
23
|
-
observableArray: IObservableArray<T>,
|
|
23
|
+
observableArray: IObservableArray<T> | Array<T>,
|
|
24
24
|
listener: (change: IArrayDidChange<T>) => void,
|
|
25
25
|
fireImmediately?: boolean
|
|
26
26
|
): Lambda
|
package/src/core/derivation.ts
CHANGED
|
@@ -203,7 +203,11 @@ function warnAboutDerivationWithoutDependencies(derivation: IDerivation) {
|
|
|
203
203
|
return
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
if (
|
|
206
|
+
if (
|
|
207
|
+
typeof derivation.requiresObservable_ === "boolean"
|
|
208
|
+
? derivation.requiresObservable_
|
|
209
|
+
: globalState.reactionRequiresObservable
|
|
210
|
+
) {
|
|
207
211
|
console.warn(
|
|
208
212
|
`[mobx] Derivation '${derivation.name_}' is created/updated without reading any observable value.`
|
|
209
213
|
)
|
package/src/core/reaction.ts
CHANGED
|
@@ -67,7 +67,7 @@ export class Reaction implements IDerivation, IReactionPublic {
|
|
|
67
67
|
public name_: string = __DEV__ ? "Reaction@" + getNextId() : "Reaction",
|
|
68
68
|
private onInvalidate_: () => void,
|
|
69
69
|
private errorHandler_?: (error: any, derivation: IDerivation) => void,
|
|
70
|
-
public requiresObservable_
|
|
70
|
+
public requiresObservable_?
|
|
71
71
|
) {}
|
|
72
72
|
|
|
73
73
|
onBecomeStale_() {
|
|
@@ -169,7 +169,7 @@ export class Reaction implements IDerivation, IReactionPublic {
|
|
|
169
169
|
if (!globalState.suppressReactionErrors) {
|
|
170
170
|
console.error(message, error)
|
|
171
171
|
/** If debugging brought you here, please, read the above message :-). Tnx! */
|
|
172
|
-
} else if (__DEV__) {console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`)} // prettier-ignore
|
|
172
|
+
} else if (__DEV__) { console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`) } // prettier-ignore
|
|
173
173
|
|
|
174
174
|
if (__DEV__ && isSpyEnabled()) {
|
|
175
175
|
spyReport({
|
|
@@ -159,7 +159,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
159
159
|
return this
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
delete(value:
|
|
162
|
+
delete(value: T) {
|
|
163
163
|
if (hasInterceptors(this)) {
|
|
164
164
|
const change = interceptChange<ISetWillChange<T>>(this, {
|
|
165
165
|
type: DELETE,
|
|
@@ -202,7 +202,7 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
|
|
|
202
202
|
return false
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
has(value:
|
|
205
|
+
has(value: T) {
|
|
206
206
|
this.atom_.reportObserved()
|
|
207
207
|
return this.data_.has(this.dehanceValue_(value))
|
|
208
208
|
}
|