<commit_before>class PushState {
  constructor(match, history) {
    this.path = match.path;
    this.history = history;
  }

  setNew() {
    this.history.push(this.path);
  }

  setEdit(note) {
    const url = `${this.path}/${note.uid}`;

    if (this.history.location.pathname !== url) {
      this.history.push(url);
    }
  }

  setBrowserTitle(note) {
    if (note && note.title) {
      document.title = `${note.title} | Mykonote`;
    }
    else {
      document.title = 'Mykonote';
    }
  }
}

export default PushState;
<commit_msg>don't keep `:id` placeholder in pushed url<commit_after>import { generatePath } from 'react-router';

class PushState {
  constructor(match, history) {
    this.path = match.path;
    this.history = history;
  }

  setNew() {
    this.history.push(this.path);
  }

  setEdit(note) {
    let path = this.path;
    if (!path.includes(':id')) {
      path = `${path}/:id`;
    }
    const url = generatePath(path, { id: note.uid});

    if (this.history.location.pathname !== url) {
      this.history.push(url);
    }
  }

  setBrowserTitle(note) {
    if (note && note.title) {
      document.title = `${note.title} | Mykonote`;
    }
    else {
      document.title = 'Mykonote';
    }
  }
}

export default PushState;

{'fraction_non_alphanumeric': 0.1625693893735131, 'fraction_numerical': 0.0, 'mean_word_length': 2.585227272727273, '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': '2095737', 'n_tokens_mistral': 453, 'n_tokens_neox': 444, 'n_words': 81}