Skip to content

Commit 14723af

Browse files
authored
Revert "feat: inheritance should work with computed (#3950)"
This reverts commit c5be226.
1 parent c5be226 commit 14723af

File tree

2 files changed

+2
-23
lines changed

2 files changed

+2
-23
lines changed

packages/mobx/__tests__/decorators_20223/stage3-decorators.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,22 +1115,3 @@ test(`decorated field can be inherited, but doesn't inherite the effect of decor
11151115
const subStore = new SubStore()
11161116
expect(isAction(subStore.action)).toBe(false)
11171117
})
1118-
1119-
test(`inheritance should work with computed`, () => {
1120-
class Store {
1121-
@computed
1122-
get getNumber() {
1123-
return 1
1124-
}
1125-
}
1126-
1127-
class SubStore extends Store {
1128-
@computed
1129-
override get getNumber() {
1130-
return super.getNumber + 1
1131-
}
1132-
}
1133-
1134-
const store = new SubStore()
1135-
expect(store.getNumber).toBe(2)
1136-
})

packages/mobx/src/types/computedannotation.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,11 @@ function decorate_20223_(this: Annotation, get, context: ClassGetterDecoratorCon
6464
options.name ||= __DEV__
6565
? `${adm.name_}.${key.toString()}`
6666
: `ObservableObject.${key.toString()}`
67-
const computedValue = new ComputedValue(options)
68-
adm.values_.set(key, computedValue)
69-
adm.values_.set(get, computedValue)
67+
adm.values_.set(key, new ComputedValue(options))
7068
})
7169

7270
return function () {
73-
return this[$mobx].getObservablePropValue_(get)
71+
return this[$mobx].getObservablePropValue_(key)
7472
}
7573
}
7674

0 commit comments

Comments
 (0)