mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-28 16:21:16 +01:00
Added guard in fetchSources.
This will mean that autocomplete is broken for sources without vector_layers key present.
This commit is contained in:
parent
ed85b838ec
commit
5ce57d0803
1 changed files with 5 additions and 1 deletions
|
@ -202,7 +202,7 @@ export default class App extends React.Component {
|
|||
layers: []
|
||||
};
|
||||
|
||||
if(!this.state.sources.hasOwnProperty(key) && val.type === "vector") {
|
||||
if(!this.state.sources.hasOwnProperty(key) && val.type === "vector" && val.hasOwnProperty("url")) {
|
||||
let url = val.url;
|
||||
try {
|
||||
url = mapboxUtil.normalizeSourceURL(url, MapboxGl.accessToken);
|
||||
|
@ -215,6 +215,10 @@ export default class App extends React.Component {
|
|||
return response.json();
|
||||
})
|
||||
.then((json) => {
|
||||
if(!json.hasOwnProperty("vector_layers")) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create new objects before setState
|
||||
const sources = Object.assign({}, this.state.sources);
|
||||
|
||||
|
|
Loading…
Reference in a new issue