Fix UI when loading invalid style with duplicate layer ids.

Also fix for throwing error when 2 layers exist with empty strings as ids.
This commit is contained in:
orangemug
2020-03-28 10:58:47 +00:00
parent f70d078ec6
commit 74b47e7e74
6 changed files with 82 additions and 38 deletions

View File

@@ -1,5 +1,6 @@
import React from 'react'
import PropTypes from 'prop-types'
import {formatLayerId} from './util/format';
class MessagePanel extends React.Component {
static propTypes = {
@@ -23,7 +24,7 @@ class MessagePanel extends React.Component {
const layerId = mapStyle.layers[parsed.data.index].id;
content = (
<>
Layer <span>&apos;{layerId}&apos;</span>: {parsed.data.message}
Layer <span>{formatLayerId(layerId)}</span>: {parsed.data.message}
{currentLayer.id !== layerId &&
<>
&nbsp;&mdash;&nbsp;