mirror of
https://github.com/maputnik/editor.git
synced 2026-06-15 11:47:26 +00:00
Ensure editor does not crash with raster layers
This commit is contained in:
@@ -31,12 +31,14 @@ export class ApiStyleStore {
|
||||
connection.onmessage = e => {
|
||||
if(!e.data) return
|
||||
console.log('Received style update from API')
|
||||
let parsedStyle = style.emptyStyle
|
||||
try {
|
||||
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
|
||||
this.onLocalStyleChange(updatedStyle)
|
||||
parsedStyle = JSON.parse(e.data)
|
||||
} catch(err) {
|
||||
console.error('Could not parse local style')
|
||||
console.error(err)
|
||||
}
|
||||
const updatedStyle = style.ensureStyleValidity(parsedStyle)
|
||||
this.onLocalStyleChange(updatedStyle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import style from './style.js'
|
||||
|
||||
export function initialStyleUrl() {
|
||||
const initialUrl = url.parse(window.location.href, true)
|
||||
console.log(initialUrl)
|
||||
return (initialUrl.query || {}).style
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user