Skip to content

Commit

Permalink
🐛 autorun add arguments that overrided props
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien JUIF committed Jan 10, 2018
1 parent c7c4d30 commit a41593b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "k-mobx-react",
"version": "0.1.1",
"version": "0.1.4",
"description": "Connect MobX (and mobx-state-tree) to React with plain old JS props!",
"main": "index.js",
"repository": "https://github.com/alakarteio/k-mobx-react.git",
Expand Down
6 changes: 3 additions & 3 deletions src/core.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const inject = injectFunction => Component => class extends React.Compone
}

let firstRun = true
this.readStore = (nextProps) => {
this.readStore = nextProps => () => {
// rerun store mapping so the flat values are processed again
// FIXME: Pass this.props ? Then we should call
// the whole function on `componentWillReceiveProps`
Expand All @@ -42,11 +42,11 @@ export const inject = injectFunction => Component => class extends React.Compone
}
}

this.dispose = autorun(this.readStore)
this.dispose = autorun(this.readStore())
}

componentWillReceiveProps(nextProps) {
this.readStore(nextProps)
this.readStore(nextProps)()
}

/* unbind observable reaction */
Expand Down

0 comments on commit a41593b

Please sign in to comment.