<commit_before>module.exports = {
  // Turbolinks 5+ got rid of named events (?!)
  setup: function(ujs) {
  	ujs.handleEvent('turbolinks:load', ujs.handleMount);
    ujs.handleEvent('turbolinks:before-render', ujs.handleMount);
  },

  teardown: function(ujs) {
  	ujs.removeEvent('turbolinks:load', ujs.handleMount);
    ujs.removeEvent('turbolinks:before-render', ujs.handleMount);
  },
}
<commit_msg>Call handleUnmount before rendering a new page (#1020)<commit_after>module.exports = {
  // Turbolinks 5+ got rid of named events (?!)
  setup: function(ujs) {
  	ujs.handleEvent('turbolinks:load', ujs.handleMount);
    ujs.handleEvent('turbolinks:before-render', ujs.handleUnmount);
  },

  teardown: function(ujs) {
  	ujs.removeEvent('turbolinks:load', ujs.handleMount);
    ujs.removeEvent('turbolinks:before-render', ujs.handleUnmount);
  },
}

{'fraction_non_alphanumeric': 0.15357561547479484, 'fraction_numerical': 0.007033997655334115, 'mean_word_length': 5.014084507042254, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1766527', 'n_tokens_mistral': 322, 'n_tokens_neox': 315, 'n_words': 47}