Skip to content

Commit

Permalink
fix object path
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Dec 24, 2015
1 parent a979b24 commit 3d6f15c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "revue",
"version": "1.2.42",
"version": "1.2.44",
"description": "Redux binding for Vue.",
"main": "revue.common.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/revue.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import objectPath from 'object-path'
import { set as setProp, get as getProp } from 'object-path'
import shallowEqual from './utils/shallowEqual'

export default function (Vue, options) {
Expand All @@ -22,12 +22,12 @@ export default function (Vue, options) {
if (re.test(prop)) {
[, storeProp, realProp] = prop.match(re)
}
let currentValue = store.getState()[storeProp]
let currentValue = getProp(store.getState(), storeProp)
const handleChange = () => {
let previousValue = currentValue
currentValue = objectPath.get(store.getState(), storeProp)
currentValue = getProp(store.getState(), storeProp)
if (!shallowEqual(previousValue, currentValue)) {
objectPath.set(this._data, realProp, currentValue)
setProp(this._data, realProp, currentValue)
}
}
this.unsubscriber.push(store.subscribe(handleChange))
Expand Down

0 comments on commit 3d6f15c

Please sign in to comment.