Skip to content

Commit

Permalink
fix: stateSync can't works on ObservableArray
Browse files Browse the repository at this point in the history
  • Loading branch information
imcuttle committed Mar 22, 2018
1 parent 40e85b7 commit 9c7be27
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/decorator/utils/getStateLifeDecorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
action,
autorun,
observable,
isObservableArray
isObservableArray,
toJS
} from 'mobx'
import logger from '../../utils/logger'

Expand Down Expand Up @@ -170,8 +171,8 @@ export default (config = {}, name = 'state-life') => {
let save = isFirst ? (
config.saveFirstTime || config.save
) : config.save
// console.log('save', urlKey, property, this[property])
save.call(config, urlKey, this[property], config.fetch())
// toJS for fix ObservableArray can't be stringify
save.call(config, urlKey, toJS(this[property]), config.fetch())
syncUrlTimer = void 0
syncUrlFn = void 0
}
Expand Down

0 comments on commit 9c7be27

Please sign in to comment.