mobx 7.0.3 → 7.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx",
3
- "version": "7.0.3",
3
+ "version": "7.0.4",
4
4
  "description": "Simple, scalable state management.",
5
5
  "source": "src/mobx.ts",
6
6
  "type": "commonjs",
@@ -19,13 +19,6 @@ import {
19
19
  recordAnnotationApplied
20
20
  } from "../internal"
21
21
 
22
- // Hack based on https://github.com/Microsoft/TypeScript/issues/14829#issuecomment-322267089
23
- // We need this, because otherwise, AdditionalKeys is going to be inferred to be any
24
- // set of superfluous keys. But, we rather want to get a compile error unless AdditionalKeys is
25
- // _explicity_ passed as generic argument
26
- // Fixes: https://github.com/mobxjs/mobx/issues/2325#issuecomment-691070022
27
- type NoInfer<T> = [T][T extends any ? 0 : never]
28
-
29
22
  export function makeObservable<T extends object, AdditionalKeys extends PropertyKey = never>(
30
23
  target: T,
31
24
  annotations: AnnotationsMap<T, NoInfer<AdditionalKeys>>,
@@ -216,7 +216,10 @@ export class ComputedValue<T> implements IObservable, IComputedValue<T>, IDeriva
216
216
  reportObserved(this)
217
217
  if (shouldCompute(this)) {
218
218
  let prevTrackingContext = globalState.trackingContext
219
- if (this.keepAlive_ && !prevTrackingContext) {
219
+ if (!prevTrackingContext && (this.keepAlive_ || this.isBeingObserved)) {
220
+ // An observed or keep-alive computed can be recomputed by an untracked
221
+ // read, for example from inside an action. Its dependencies are still
222
+ // transitively observed and must fire their lifecycle hooks
220
223
  globalState.trackingContext = this
221
224
  }
222
225
  if (this.trackAndCompute()) {
@@ -45,7 +45,7 @@ export interface IReactionPublic {
45
45
  dispose(): void
46
46
  }
47
47
 
48
- export interface IReactionDisposer {
48
+ export interface IReactionDisposer extends Disposable {
49
49
  (): void
50
50
  [$mobx]: Reaction
51
51
  }