Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorate - compose decorators for a single prop (mobx4) #1691

Merged

Conversation

ramybenaroya
Copy link
Contributor

PR checklist:

  • Added unit tests
  • Updated changelog
  • Updated docs (either in the description of this PR as markdown, or as separate PR on the gh-pages branch. Please refer to this PR). For new functionality, at least API.md should be updated
  • Added typescript typings
  • Verified that there is no significant performance drop (npm run perf)

Support decorate new functionality introduced in #1652 in MobX 4

Changes

  • Reduce multiple decorators to a single decorator
  • Added a test for multiple decorators (@action + custom) on a function property
  • Added a test for multiple decorators (@observable + @serializable) on
    a regular property
  • Added a usage example (+ caveat warning) in readme under decorate section

Usage Example:

import { decorate, observable } from "mobx"
import { serializable, primitive } from "serializr"
import persist from 'mobx-persist';

class Todo {
    id = Math.random();
    title = "";
    finished = false;
}
decorate(Todo, {
    title: [serializable(primitive), persist('object'), observable],
    finished: observable
})

Ramy Ben Aroya and others added 3 commits August 15, 2018 14:52
* decorate - compose decorators for a single prop

- Reduce multiple decorators to a single decorator
- Added a test for multiple decorators (@action + custom) on a function property
- Added a test for multiple decorators (@observable + @serializable) on
  a regular property
- Added a usage example in readme under `decorate` section

* delete package-lock

* doc: update README

- Change caveat note about docorators composition as suggested in
  mobxjs#1652 (comment)
- Add decorators application order

* Update README.md
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.801% when pulling a703d0c on ramybenaroya:compose-property-decorator-mobx4 into ad4288d on mobxjs:mobx4-master.

@mweststrate mweststrate merged commit 082210f into mobxjs:mobx4-master Aug 20, 2018
@mweststrate
Copy link
Member

Thanks! Will release soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants