<commit_before>import React, { PropTypes } from 'react'

import { white, blue, black, gray } from '../../constants/colors'

import {
  EMISSION_RADIUS,
  ARROW_WIDTH_FACTOR
} from './constants'

import Defs from './defs'
import Arrow from './arrow'
import Separators from './separators'
import Emission from './emission'
import Completion from './completion'
import makeTransformFactor from './makeTransformFactor'

const SEPARATORS = 20

const ObservableView = ({
  width = 500,
  height = 50,
  x,
  y,
  completion = 1,
  emissions = [],
  onMouseDown,
  onMouseUp,
  getRef,
  isDragging, // NOTE: id of the emission that is being dragged
  onChange // NOTE: Just for isDraggable
}) => {
  const transformFactor = makeTransformFactor({ width, height })

  const last = emissions[emissions.length - 1]
  const lastCoincidesCompletion = last.x === completion

  const leftX = transformFactor(0) * width
  const rightX = transformFactor(1) * width

  return (
    <svg
      viewBox={`0 0 ${width} ${height}`}
      width={width}
      height={height}
      x={x}
      y={y}
      ref={ref => getRef && getRef(ref)}
    >
      <Defs x={completion ? transformFactor(completion) : 1}/>
      <Arrow height={height} width={width}/>
      <Separators height={height} width={width} transformFactor={transformFactor}/>

      { completion && (
        <Completion
          bold={lastCoincidesCompletion}
          x={transformFactor(completion)}
          height={height}
          width={width}
        />
      )}

      {
        emissions.map(({ x, ...props }, i) => (
          <Emission
            {...props}
            isDraggable={typeof onChange === 'function'}
            isDragging={props.id !== undefined && isDragging === props.id}
            key={props.id || i}
            width={width}
            height={height}
            stroke="url(#stroke)"
            x={transformFactor(x)}
            onMouseDown={(data) => {
              onMouseDown && onMouseDown({
                ...data,<commit_msg>Remove naive emission key optimisation<commit_after>import React, { PropTypes } from 'react'

import { white, blue, black, gray } from '../../constants/colors'

import {
  EMISSION_RADIUS,
  ARROW_WIDTH_FACTOR
} from './constants'

import Defs from './defs'
import Arrow from './arrow'
import Separators from './separators'
import Emission from './emission'
import Completion from './completion'
import makeTransformFactor from './makeTransformFactor'

const SEPARATORS = 20

const ObservableView = ({
  width = 500,
  height = 50,
  x,
  y,
  completion = 1,
  emissions = [],
  onMouseDown,
  onMouseUp,
  getRef,
  isDragging, // NOTE: id of the emission that is being dragged
  onChange // NOTE: Just for isDraggable
}) => {
  const transformFactor = makeTransformFactor({ width, height })

  const last = emissions[emissions.length - 1]
  const lastCoincidesCompletion = last.x === completion

  const leftX = transformFactor(0) * width
  const rightX = transformFactor(1) * width

  return (
    <svg
      viewBox={`0 0 ${width} ${height}`}
      width={width}
      height={height}
      x={x}
      y={y}
      ref={ref => getRef && getRef(ref)}
    >
      <Defs x={completion ? transformFactor(completion) : 1}/>
      <Arrow height={height} width={width}/>
      <Separators height={height} width={width} transformFactor={transformFactor}/>

      { completion && (
        <Completion
          bold={lastCoincidesCompletion}
          x={transformFactor(completion)}
          height={height}
          width={width}
        />
      )}

      {
        emissions.map(({ x, ...props }, i) => (
          <Emission
            {...props}
            key={i}
            isDraggable={typeof onChange === 'function'}
            isDragging={props.id !== undefined && isDragging === props.id}
            width={width}
            height={height}
            stroke="url(#stroke)"
            x={transformFactor(x)}
            onMouseDown={(data) => {
              onMouseDown && onMouseDown({
                ...data,
{'fraction_non_alphanumeric': 0.13615023474178403, 'fraction_numerical': 0.006918705213738572, 'mean_word_length': 2.4657534246575343, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '1191113', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1169, 'n_words': 296}