<commit_before>import { observer } from 'mobx-react';
import { hot } from 'react-hot-loader';
import React from 'react';
import AppStore from '../../../../app/store';
import Store from '../../store';
import db from '../../../../shared/models/app-database';
import Item from '../Item';
import TreeBar from '../TreeBar';
import { Content, Items } from './styles';

@observer
class Bookmarks extends React.Component {
  public componentDidMount() {
    this.loadBookmarks();
  }

  public loadBookmarks = async () => {
    const bookmarks = await db.bookmarks.toArray();

    db.favicons.each(favicon => {
      if (AppStore.favicons[favicon.url] == null && favicon.favicon.byteLength !== 0) {
        AppStore.favicons[favicon.url] = window.URL.createObjectURL(new Blob([favicon.favicon]));
      }
    });

    Store.bookmarks = bookmarks;
    Store.goTo(-1);
  };

  public render() {
    return (
      <React.Fragment>
        <TreeBar />
        <Content>
          {Store.bookmarks.length > 0 && (
            <Items>
              {Store.bookmarks.map(data => {
                if (data.parent === Store.currentTree) {
                  return <Item data={data} key={data.id} />;
                }
                return null;
              })}
            </Items>
          )}
        </Content>
      </React.Fragment>
    );
  }
}

export default hot(module)(Bookmarks);<commit_msg>Fix empty container in bookmarks<commit_after>import { observer } from 'mobx-react';
import { hot } from 'react-hot-loader';
import React from 'react';
import AppStore from '../../../../app/store';
import Store from '../../store';
import db from '../../../../shared/models/app-database';
import Item from '../Item';
import TreeBar from '../TreeBar';
import { Content, Items } from './styles';

@observer
class Bookmarks extends React.Component {
  public componentDidMount() {
    this.loadBookmarks();
  }

  public loadBookmarks = async () => {
    const bookmarks = await db.bookmarks.toArray();

    db.favicons.each(favicon => {
      if (AppStore.favicons[favicon.url] == null && favicon.favicon.byteLength !== 0) {
        AppStore.favicons[favicon.url] = window.URL.createObjectURL(new Blob([favicon.favicon]));
      }
    });

    Store.bookmarks = bookmarks;
    Store.goTo(-1);
  };

  public render() {
    const items = Store.bookmarks.filter(r => r.parent === Store.currentTree);

    return (
      <React.Fragment>
        <TreeBar />
        <Content>
          {items.length > 0 && (
            <Items>
              {items.map(data => <Item data={data} key={data.id} />)}
            </Items>
          )}
        </Content>
      </React.Fragment>
    );
  }
}

export default hot(module)(Bookmarks);
{'fraction_non_alphanumeric': 0.1680796166605234, 'fraction_numerical': 0.0022115739034279398, 'mean_word_length': 2.273823884197829, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 28, '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': '408829', 'n_tokens_mistral': 834, 'n_tokens_neox': 801, 'n_words': 180}