<commit_before>import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import { ToggleButton } from "../../../controls/toggle_button";
import { Content } from "../../../constants";
import { updateConfig } from "../../actions";
import { noop } from "lodash";
import { getDevice } from "../../../device";

interface AutoSyncRowProps { currentValue: boolean; }

export function AutoSyncRow(props: AutoSyncRowProps) {
  const auto_sync = !props.currentValue;
  return <Row>
    <Col xs={2}>
      <label>
        {t("AUTO SYNC")}
      </label>
    </Col>
    <Col xs={7}>
      <p>
        {t(Content.AUTO_SYNC)}
      </p>
    </Col>
    <Col xs={3}>
      <ToggleButton toggleValue={props.currentValue}
        toggleAction={() => {
          updateConfig({ auto_sync })(noop);
          getDevice().sync();
        }} />
    </Col>
  </Row>;
}<commit_msg>fix double sync bug<commit_after>import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import { ToggleButton } from "../../../controls/toggle_button";
import { Content } from "../../../constants";
import { updateConfig } from "../../actions";
import { noop } from "lodash";

interface AutoSyncRowProps { currentValue: boolean; }

export function AutoSyncRow(props: AutoSyncRowProps) {
  const auto_sync = !props.currentValue;
  return <Row>
    <Col xs={2}>
      <label>
        {t("AUTO SYNC")}
      </label>
    </Col>
    <Col xs={7}>
      <p>
        {t(Content.AUTO_SYNC)}
      </p>
    </Col>
    <Col xs={3}>
      <ToggleButton toggleValue={props.currentValue}
        toggleAction={() => {
          updateConfig({ auto_sync })(noop);
        }} />
    </Col>
  </Row>;
}
{'fraction_non_alphanumeric': 0.19506597819850832, 'fraction_numerical': 0.005737234652897304, 'mean_word_length': 2.467196819085487, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 31, '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': '3519967', 'n_tokens_mistral': 554, 'n_tokens_neox': 559, 'n_words': 140}