<commit_before>/* @flow */

import { multiPolygon } from 'leaflet'
import { PropTypes } from 'react'

import latlngListType from './types/latlngList'
import Path from './Path'

export default class MultiPolygon extends Path {
  static propTypes = {
    polygons: PropTypes.arrayOf(latlngListType).isRequired,
  };

  componentWillMount () {
    super.componentWillMount()
    const { polygons, ...props } = this.props
    this.leafletElement = multiPolygon(polygons, props)
  }

  componentDidUpdate (prevProps: Object) {
    if (this.props.polygons !== prevProps.polygons) {
      this.leafletElement.setLatLngs(this.props.polygons)
    }
    this.setStyleIfChanged(prevProps, this.props)
  }
}<commit_msg>Updated MultiPolygon 'polygons' prop to allow polygons with holes (#218)<commit_after>/* @flow */

import { multiPolygon } from 'leaflet'
import { PropTypes } from 'react'

import latlngListType from './types/latlngList'
import Path from './Path'

export default class MultiPolygon extends Path {
  static propTypes = {
    polygons: PropTypes.arrayOf(
      PropTypes.oneOfType([
        latlngListType,
        PropTypes.arrayOf(latlngListType),
      ])
    ).isRequired,
  };

  componentWillMount () {
    super.componentWillMount()
    const { polygons, ...props } = this.props
    this.leafletElement = multiPolygon(polygons, props)
  }

  componentDidUpdate (prevProps: Object) {
    if (this.props.polygons !== prevProps.polygons) {
      this.leafletElement.setLatLngs(this.props.polygons)
    }
    this.setStyleIfChanged(prevProps, this.props)
  }
}
{'fraction_non_alphanumeric': 0.11543367346938775, 'fraction_numerical': 0.001913265306122449, 'mean_word_length': 3.7117117117117115, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '766690', 'n_tokens_mistral': 512, 'n_tokens_neox': 505, 'n_words': 105}