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

@@ -48,7 +48,9 @@ export class Toolbar extends React.Component {
const reader = new FileReader();
reader.readAsText(file, "UTF-8");
reader.onload = e => {
this.props.onStyleUpload(style.fromJSON(JSON.parse(e.target.result)));
let mapStyle = style.fromJSON(JSON.parse(e.target.result))
mapStyle = style.ensureMetadataExists(mapStyle)
this.props.onStyleUpload(mapStyle);
}
reader.onerror = e => console.log(e.target);
}