<commit_before>import { MsgData, Contact, Msg, LastMsg, SearchRes, Pane, Redraw } from './interfaces';
import notify from 'common/notification';
import * as network from './network';

export default class MsgCtrl {

  data: MsgData;
  searchRes?: SearchRes;
  pane: Pane;

  constructor(data: MsgData, readonly trans: Trans, readonly redraw: Redraw) {
    this.data = data;
    this.pane = data.convo ? 'convo' : 'side';
    network.websocketHandler(this);
    window.addEventListener('focus', this.setRead);
  };

  openConvo = (userId: string) => {
    if (this.data.convo?.user.id != userId) this.data.convo = undefined;
    network.loadConvo(userId).then(data => {
      this.data = data;
      this.searchRes = undefined;<commit_msg>msg: avoid flashing the previous convo on mobile view<commit_after>import { MsgData, Contact, Msg, LastMsg, SearchRes, Pane, Redraw } from './interfaces';
import notify from 'common/notification';
import * as network from './network';

export default class MsgCtrl {

  data: MsgData;
  searchRes?: SearchRes;
  pane: Pane;

  constructor(data: MsgData, readonly trans: Trans, readonly redraw: Redraw) {
    this.data = data;
    this.pane = data.convo ? 'convo' : 'side';
    network.websocketHandler(this);
    window.addEventListener('focus', this.setRead);
  };

  openConvo = (userId: string) => {
    // this to avoid flashing the previous convo on mobile view
    if (this.pane == 'side' && this.data.convo?.user.id != userId) this.data.convo = undefined;
    network.loadConvo(userId).then(data => {
      this.data = data;
      this.searchRes = undefined;
{'fraction_non_alphanumeric': 0.13474734872114785, 'fraction_numerical': 0.0, 'mean_word_length': 3.8459214501510575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3698028', 'n_tokens_mistral': 514, 'n_tokens_neox': 508, 'n_words': 137}