Skip to content

Commit

Permalink
feat: make compatiable with old version mobx (#84)
Browse files Browse the repository at this point in the history
* feat: make compatiable with old version mobx

* chore: change readme
  • Loading branch information
iChenLei authored Jan 7, 2022
1 parent 8d4da71 commit 5ee8734
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Vue2 bindings for MobX, inspired by [mobx-react](https://github.com/mobxjs/mobx-
## Support Table
| package | mobx v6 | mobx v2/v3/v4/v5 | vue2 | vue3 |
| ------ | ------- | ---------------- | ---- | ---- |
| [mobx-vue](https://github.com/mobxjs/mobx-vue) | >= 2.1.0 | < 2.1.0 | * | - |
| [mobx-vue](https://github.com/mobxjs/mobx-vue) | >= v2.1.0 | * (exclude v2.1.0) | * | - |
| [mobx-vue-lite](https://github.com/mobxjs/mobx-vue-lite) | * | - | - | * |
> `*` means `all` and `-` means `none`
Expand All @@ -28,10 +28,6 @@ or
yarn add mobx-vue
```

## Requirement
* Vue >= 2.0.0
* MobX >= 2.0.0, compatible with MobX 5!

## Why mobx-vue

MobX is an unopinionated, scalable state management, which can make our programming more intuitive.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"homepage": "https://github.com/mobxjs/mobx-vue#readme",
"peerDependencies": {
"mobx": "^6.0.0",
"mobx": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
"vue": "^2.0.0"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ function observer<VC extends VueClass<Vue>>(Component: VC | ComponentOptions<Vue

const reaction = new Reaction(`${name}.render()`, reactiveRender);

this[disposerSymbol] = reaction.getDisposer_();
// @ts-expect-error
this[disposerSymbol] = reaction.getDisposer_?.() || reaction.getDisposer?.();

return reactiveRender();
};
Expand Down

0 comments on commit 5ee8734

Please sign in to comment.