diff --git a/packages/mobx/__tests__/decorators_20223/stage3-decorators.ts b/packages/mobx/__tests__/decorators_20223/stage3-decorators.ts index e76c8f9fb..3dc2fa637 100644 --- a/packages/mobx/__tests__/decorators_20223/stage3-decorators.ts +++ b/packages/mobx/__tests__/decorators_20223/stage3-decorators.ts @@ -334,9 +334,7 @@ function normalizeSpyEvents(events: any[]) { test("action decorator (2022.3)", () => { class Store { - constructor(private multiplier: number) { - makeObservable(this) - } + constructor(private multiplier: number) {} @action add(a: number, b: number): number { @@ -366,9 +364,7 @@ test("action decorator (2022.3)", () => { test("custom action decorator (2022.3)", () => { class Store { - constructor(private multiplier: number) { - makeObservable(this) - } + constructor(private multiplier: number) {} @action("zoem zoem") add(a: number, b: number): number { @@ -416,9 +412,7 @@ test("custom action decorator (2022.3)", () => { test("action decorator on field (2022.3)", () => { class Store { - constructor(private multiplier: number) { - makeObservable(this) - } + constructor(private multiplier: number) {} @action add = (a: number, b: number) => { @@ -450,9 +444,7 @@ test("action decorator on field (2022.3)", () => { test("custom action decorator on field (2022.3)", () => { class Store { - constructor(private multiplier: number) { - makeObservable(this) - } + constructor(private multiplier: number) {} @action("zoem zoem") add = (a: number, b: number) => { diff --git a/packages/mobx/src/types/actionannotation.ts b/packages/mobx/src/types/actionannotation.ts index 831cf5236..f1572c0bc 100644 --- a/packages/mobx/src/types/actionannotation.ts +++ b/packages/mobx/src/types/actionannotation.ts @@ -73,12 +73,8 @@ function decorate_20223_(this: Annotation, mthd, context: DecoratorContext) { const _createAction = m => createAction(ann.options_?.name ?? name!.toString(), m, ann.options_?.autoAction ?? false) - // Backwards/Legacy behavior, expects makeObservable(this) if (kind == "field") { - addInitializer(function () { - storeAnnotation(this, name, ann) - }) - return + return _createAction } if (kind == "method") {