<commit_before>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { LayerManager, Layer } from 'layer-manager/dist/components';
import { PluginMapboxGl } from 'layer-manager';

class LayerManagerComponent extends PureComponent {
  render() {
    const { layers, geostore, setMapLoading, basemap, map } = this.props;

    return (
      <LayerManager
        map={map}
        plugin={PluginMapboxGl}
        onLayerLoading={loading => setMapLoading(loading)}
      >
        {geostore &&
          geostore.id && (
          <Layer
            key={geostore.id}
            id={geostore.id}
            name="Geojson"
            provider="geojson"
            params={{
              id: geostore.id
            }}
            layerConfig={{
              data: geostore.geojson,
              body: {
                vectorLayers: [
                  {
                    id: `${geostore.id}-fill`,
                    type: 'fill',
                    source: geostore.id,
                    paint: {
                      'fill-color': 'transparent'
                    }
                  },
                  {
                    id: `${geostore.id}-line`,
                    type: 'line',
                    source: geostore.id,
                    paint: {
                      'line-color': '#000',
                      'line-width': 2
                    }
                  }
                ]
              }
            }}
            zIndex={1060}
          />
        )}
        {layers && layers.map(l => <Layer key={l.id} {...l} />)}
        {basemap &&
          basemap.url && (
          <Layer
            key={basemap.url}
            id="basemap"
            name="Basemap"
            provider="leaflet"
            layerConfig={{
              body: {
                url: basemap.url
              }
            }}
            zIndex={100}
          />
        )}
      </LayerManager>
    );
  }
}

LayerManagerComponent.propTypes = {
  loading: PropTypes.bool,
  layers: PropTypes.array,
  basemap: PropTypes.object,
  geostore: PropTypes.object,
  setMapLoading: PropTypes.func,
  map: PropTypes.object
};

export default LayerManagerComponent;<commit_msg>fix resetting of basemap from url with react keys and id<commit_after>import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { LayerManager, Layer } from 'layer-manager/dist/components';
import { PluginMapboxGl } from 'layer-manager';

class LayerManagerComponent extends PureComponent {
  render() {
    const { layers, geostore, setMapLoading, basemap, map } = this.props;

    return (
      <LayerManager
        map={map}
        plugin={PluginMapboxGl}
        onLayerLoading={loading => setMapLoading(loading)}
      >
        {geostore &&
          geostore.id && (
          <Layer
            key={geostore.id}
            id={geostore.id}
            name="Geojson"
            provider="geojson"
            params={{
              id: geostore.id
            }}
            layerConfig={{
              data: geostore.geojson,
              body: {
                vectorLayers: [
                  {
                    id: `${geostore.id}-fill`,
                    type: 'fill',
                    source: geostore.id,
                    paint: {
                      'fill-color': 'transparent'
                    }
                  },
                  {
                    id: `${geostore.id}-line`,
                    type: 'line',
                    source: geostore.id,
                    paint: {
                      'line-color': '#000',
                      'line-width': 2
                    }
                  }
                ]
              }
            }}
            zIndex={1060}
          />
        )}
        {layers && layers.map(l => <Layer key={l.id} {...l} />)}
        {basemap &&
          basemap.url && (
          <Layer
            key={basemap.url}
            id={basemap.url}
            name="Basemap"
            provider="leaflet"
            layerConfig={{
              body: {
                url: basemap.url
              }
            }}
            zIndex={100}
          />
        )}
      </LayerManager>
    );
  }
}

LayerManagerComponent.propTypes = {
  loading: PropTypes.bool,
  layers: PropTypes.array,
  basemap: PropTypes.object,
  geostore: PropTypes.object,
  setMapLoading: PropTypes.func,
  map: PropTypes.object
};

export default LayerManagerComponent;
{'fraction_non_alphanumeric': 0.11426669625027734, 'fraction_numerical': 0.00488129576214777, 'mean_word_length': 1.1756756756756757, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '258742', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1208, 'n_words': 221}