<commit_before>import * as R from 'ramda';
import React from 'react';
import PropTypes from 'prop-types';
import $ from 'sanctuary-def';
import { $Maybe, foldMaybe } from 'xod-func-tools';
import { Icon } from 'react-fa';
import { shouldUpdate } from 'recompose';

import sanctuaryPropType from '../../utils/sanctuaryPropType';
import Breadcrumbs from './Breadcrumbs';
import TooltipHOC from '../../tooltip/components/TooltipHOC';

import { DEBUGGER_TAB_ID } from '../../editor/constants';

const DebuggerTopPane = props =>
  foldMaybe(
    null,
    tab =>
      tab.id === DEBUGGER_TAB_ID && props.isDebugSessionRunning ? (
        <Breadcrumbs>
          {props.isDebugSessionOutdated ? (
            <TooltipHOC
              content={
                <div>
                  The program on screen is newer than the program running on the
                  board.<br />
                  Watches and overall behavior can be incorrect. Stop debugging
                  and upload again to synchronize.
                </div>
              }
              render={(onMouseOver, onMouseMove, onMouseLeave) => (
                <div
                  className="debugging-outdated"
                  onMouseOver={onMouseOver}
                  onMouseMove={onMouseMove}
                  onMouseLeave={onMouseLeave}
                >
                  Program changed
                  <Icon name="question-circle" />
                </div>
              )}
            />
          ) : null}
          <button
            className="debug-session-stop-button Button Button--light"
            onClick={props.stopDebuggerSession}
          >
            <Icon name="stop" /> Stop debug
          </button>
        </Breadcrumbs>
      ) : null,
    props.currentTab
  );

DebuggerTopPane.propTypes = {
  currentTab: sanctuaryPropType($Maybe($.Object)),
  isDebugSessionRunning: PropTypes.bool,
  isDebugSessionOutdated: PropTypes.bool,
  stopDebuggerSession: PropTypes.func.isRequired,
};

DebuggerTopPane.defaultProps = {
  isDebugSessionRunning: false,
  isDebugSessionOutdated: false,
};

export default shouldUpdate(
  R.compose(
    R.not,
    R.eqBy(
      R.evolve({
        currentTab: foldMaybe(null, R.identity),
        stopDebuggerSession: () => null,
      })
    )
  )
)(DebuggerTopPane);<commit_msg>fix(xod-client): get rid of React warning in DebuggerTopPane when it runs in browser client<commit_after>import * as R from 'ramda';
import React from 'react';
import PropTypes from 'prop-types';
import $ from 'sanctuary-def';
import { $Maybe, foldMaybe, noop } from 'xod-func-tools';
import { Icon } from 'react-fa';
import { shouldUpdate } from 'recompose';

import sanctuaryPropType from '../../utils/sanctuaryPropType';
import Breadcrumbs from './Breadcrumbs';
import TooltipHOC from '../../tooltip/components/TooltipHOC';

import { DEBUGGER_TAB_ID } from '../../editor/constants';

const DebuggerTopPane = props =>
  foldMaybe(
    null,
    tab =>
      tab.id === DEBUGGER_TAB_ID && props.isDebugSessionRunning ? (
        <Breadcrumbs>
          {props.isDebugSessionOutdated ? (
            <TooltipHOC
              content={
                <div>
                  The program on screen is newer than the program running on the
                  board.<br />
                  Watches and overall behavior can be incorrect. Stop debugging
                  and upload again to synchronize.
                </div>
              }
              render={(onMouseOver, onMouseMove, onMouseLeave) => (
                <div
                  className="debugging-outdated"
                  onMouseOver={onMouseOver}
                  onMouseMove={onMouseMove}
                  onMouseLeave={onMouseLeave}
                >
                  Program changed
                  <Icon name="question-circle" />
                </div>
              )}
            />
          ) : null}
          <button
            className="debug-session-stop-button Button Button--light"
            onClick={props.stopDebuggerSession}
          >
            <Icon name="stop" /> Stop debug
          </button>
        </Breadcrumbs>
      ) : null,
    props.currentTab
  );

DebuggerTopPane.propTypes = {
  currentTab: sanctuaryPropType($Maybe($.Object)),
  isDebugSessionRunning: PropTypes.bool,
  isDebugSessionOutdated: PropTypes.bool,
  stopDebuggerSession: PropTypes.func,
};

DebuggerTopPane.defaultProps = {
  isDebugSessionRunning: false,
  isDebugSessionOutdated: false,
  stopDebuggerSession: noop,
};

export default shouldUpdate(
  R.compose(
    R.not,
    R.eqBy(
      R.evolve({
        currentTab: foldMaybe(null, R.identity),
        stopDebuggerSession: () => null,
      })
    )
  )
)(DebuggerTopPane);
{'fraction_non_alphanumeric': 0.10697674418604651, 'fraction_numerical': 0.0, 'mean_word_length': 1.9924098671726755, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 35, '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': '531620', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1304, 'n_words': 297}