Correctly load previously saved style

This commit is contained in:
lukasmartinelli
2016-09-21 08:25:10 +02:00
parent af34049069
commit 9d4053dd78
4 changed files with 11 additions and 10 deletions

View File

@@ -29,10 +29,9 @@ export default class App extends React.Component {
workContext: "layers",
currentStyle: this.styleStore.latestStyle(),
}
loadDefaultStyle(mapStyle => {
this.onStyleUpload(mapStyle)
})
if(this.state.currentStyle.get('layers').size === 0) {
loadDefaultStyle(mapStyle => this.onStyleUpload(mapStyle))
}
}
getChildContext() {
@@ -57,6 +56,7 @@ export default class App extends React.Component {
onStyleSave() {
const snapshotStyle = this.state.currentStyle.set('modified', new Date().toJSON())
this.setState({ currentStyle: snapshotStyle })
this.styleStore.save(snapshotStyle)
}
onStyleChanged(newStyle) {