<commit_before>import 'babel/polyfill';

// Mutations
import ToggleWidgetEnableMutation from '../mutations/ToggleWidgetEnableMutation';

class App extends React.Component {
  _handleToggleEnabled = () => {
    Relay.Store.update(new ToggleWidgetEnableMutation({
      widget: this.props.viewer.widgets.edges[0].node
    }));
  }
  
  render() {
    return (
      <div>
        <h1>Widget list</h1>
        <ul>
          {this.props.viewer.widgets.edges.map(edge =>
            <li>
              {edge.node.name} (ID: {edge.node.id}) Enabled: {edge.node.enabled ? <span>TRUE</span> : <span>FALSE</span>}
              <button onClick={this._handleToggleEnabled}>
                Toggle on/off
              </button>
            </li>
          )}
        </ul>
      </div>
    );
  }
}

export default Relay.createContainer(App, {
  fragments: {
    viewer: () => Relay.QL`
      fragment on User {
        widgets(first: 10) {
          edges {
            node {
              id,
              name,
              enabled,
              ${ToggleWidgetEnableMutation.getFragment('widget')}
            },
          },
        },
      }
    `,
  },
});
<commit_msg>Mutating related elements<commit_after>import 'babel/polyfill';

// Mutations
import ToggleWidgetEnableMutation from '../mutations/ToggleWidgetEnableMutation';

class App extends React.Component {
  _handleToggleEnabled = (i) => {
    Relay.Store.update(new ToggleWidgetEnableMutation({
      widget: this.props.viewer.widgets.edges[i].node
    }));
  }
  
  render() {
    return (
      <div>
        <h1>Widget list</h1>
        <ul>
          {this.props.viewer.widgets.edges.map((edge, i) =>
            <li>
              {edge.node.name} (ID: {edge.node.id}) Enabled: {edge.node.enabled ? <span>TRUE</span> : <span>FALSE</span>}
              <button onClick={this._handleToggleEnabled.bind(null, i)} id={'button' + i}>
                Toggle on/off
              </button>
            </li>
          )}
        </ul>
      </div>
    );
  }
}

export default Relay.createContainer(App, {
  fragments: {
    viewer: () => Relay.QL`
      fragment on User {
        widgets(first: 10) {
          edges {
            node {
              id,
              name,
              enabled,
              ${ToggleWidgetEnableMutation.getFragment('widget')}
            },
          },
        },
      }
    `,
  },
});

{'fraction_non_alphanumeric': 0.14255852842809363, 'fraction_numerical': 0.003762541806020067, 'mean_word_length': 1.6917885264341956, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 37, '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': '1507856', 'n_tokens_mistral': 742, 'n_tokens_neox': 726, 'n_words': 119}