<commit_before>import React from 'react';
import * as ContextService from '../../../../../services/context-service';
import { getPropertySupportedOperators } from '../../../../../services/operators-provider';
import PropertyComboBox from './PropertyComboBox';

const propertyTypeDetailsToComparer = propertyTypeDetails =>
  propertyTypeDetails.comparer ? { $compare: propertyTypeDetails.comparer } : {};

export default ({ mutate, ...props }) => {
  const selectProperty = (newProperty) => {
    const propertyTypeDetails = ContextService.getPropertyTypeDetails(newProperty.value);
    const supportedOperators = getPropertySupportedOperators(propertyTypeDetails);
    const newOperator = supportedOperators[0];

    const newValue = newOperator.getValue(
      newProperty.defaultValue || '',
      propertyTypeDetailsToComparer(propertyTypeDetails),
    );
    mutate.apply(m => m.updateKey(newProperty.value).updateValue(newValue));
  };

  return <PropertyComboBox {...props} onPropertyChange={selectProperty} />;
};<commit_msg>add component name for easier debugging<commit_after>import React from 'react';
import * as ContextService from '../../../../../services/context-service';
import { getPropertySupportedOperators } from '../../../../../services/operators-provider';
import PropertyComboBox from './PropertyComboBox';

const propertyTypeDetailsToComparer = propertyTypeDetails =>
  propertyTypeDetails.comparer ? { $compare: propertyTypeDetails.comparer } : {};

const PropertyName = ({ mutate, ...props }) => {
  const selectProperty = (newProperty) => {
    const propertyTypeDetails = ContextService.getPropertyTypeDetails(newProperty.value);
    const supportedOperators = getPropertySupportedOperators(propertyTypeDetails);
    const newOperator = supportedOperators[0];

    const newValue = newOperator.getValue(
      newProperty.defaultValue || '',
      propertyTypeDetailsToComparer(propertyTypeDetails),
    );
    mutate.apply(m => m.updateKey(newProperty.value).updateValue(newValue));
  };

  return <PropertyComboBox {...props} onPropertyChange={selectProperty} />;
};

export default PropertyName;
{'fraction_non_alphanumeric': 0.13452492944496708, 'fraction_numerical': 0.0009407337723424271, 'mean_word_length': 4.795640326975477, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '835855', 'n_tokens_mistral': 532, 'n_tokens_neox': 532, 'n_words': 108}