mobx 6.13.2 → 6.13.3

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": "6.13.2",
3
+ "version": "6.13.3",
4
4
  "description": "Simple, scalable state management.",
5
5
  "source": "src/mobx.ts",
6
6
  "main": "dist/index.js",
@@ -8,8 +8,7 @@ import {
8
8
  Annotation,
9
9
  globalState,
10
10
  MakeResult,
11
- assert20223DecoratorType,
12
- storeAnnotation
11
+ assert20223DecoratorType
13
12
  } from "../internal"
14
13
 
15
14
  export function createActionAnnotation(name: string, options?: object): Annotation {
@@ -73,12 +72,18 @@ function decorate_20223_(this: Annotation, mthd, context: DecoratorContext) {
73
72
  const _createAction = m =>
74
73
  createAction(ann.options_?.name ?? name!.toString(), m, ann.options_?.autoAction ?? false)
75
74
 
76
- // Backwards/Legacy behavior, expects makeObservable(this)
77
75
  if (kind == "field") {
78
- addInitializer(function () {
79
- storeAnnotation(this, name, ann)
80
- })
81
- return
76
+ return function (initMthd) {
77
+ let mthd = initMthd
78
+ if (!isAction(mthd)) {
79
+ mthd = _createAction(mthd)
80
+ }
81
+ if (ann.options_?.bound) {
82
+ mthd = mthd.bind(this)
83
+ mthd.isMobxAction = true
84
+ }
85
+ return mthd
86
+ }
82
87
  }
83
88
 
84
89
  if (kind == "method") {