<commit_before>var _      = require('lodash');
var React  = require('react/addons');

var Search = require('component/Search.jsx');

var dom = require('util/dom');

module.exports = React.createClass({
  getDefaultProps : function () {
    return {
      onSearch   : _.noop,
      searchable : false,
      x          : 0,
      y          : 0
    };
  },

	getInitialState: function(){
	   return {
	     maxHeight   : 'none',
	     marginLeft  : 0,
       orientation : 'center',
       pattern     : ''
	   };
	},

	componentDidMount: function(){
	  window.addEventListener('resize', this._onResize);

	  this._onResize();
	},

  componentWillUnmount : function () {
    window.removeEventListener('resize', this._onResize);
  },

	_onResize : function () {
    var menu  = dom.dimensions(React.findDOMNode(this.refs.menu));
    var items = (this.refs.itemlist ? dom.dimensions(React.findDOMNode(this.refs.itemlist)) : {height:0});

    // Compute offset relative to the viewport
    var x = this.props.x - window.pageXOffset;
    var y = this.props.y - window.pageYOffset;

    // Default position is centered
    var orientation = 'center';
    var marginLeft  = -menu.width / 2;
<commit_msg>Resize the menu as it is filtered<commit_after>var _      = require('lodash');
var React  = require('react/addons');

var Search = require('component/Search.jsx');

var dom = require('util/dom');

module.exports = React.createClass({
  getDefaultProps : function () {
    return {
      onSearch   : _.noop,
      searchable : false,
      x          : 0,
      y          : 0
    };
  },

	getInitialState: function(){
	   return {
	     maxHeight   : 'none',
	     marginLeft  : 0,
       orientation : 'center',
       pattern     : ''
	   };
	},

	componentDidMount: function(){
	  window.addEventListener('resize', this._onResize);

	  this._onResize();
	},

  componentDidUpdate : function () {
    this._onResize();
  },

  componentWillUnmount : function () {
    window.removeEventListener('resize', this._onResize);
  },

  shouldComponentUpdate : function (nextProps, nextState) {
    return !_.isEqual(nextProps, this.props) || !_.isEqual(nextState, this.state);
  },

	_onResize : function () {
    var menu  = dom.dimensions(React.findDOMNode(this.refs.menu));
    var items = (this.refs.itemlist ? dom.dimensions(React.findDOMNode(this.refs.itemlist)) : {height:0});

    // Compute offset relative to the viewport
    var x = this.props.x - window.pageXOffset;
    var y = this.props.y - window.pageYOffset;

    // Default position is centered
    var orientation = 'center';
    var marginLeft  = -menu.width / 2;

{'fraction_non_alphanumeric': 0.1376425855513308, 'fraction_numerical': 0.0038022813688212928, 'mean_word_length': 2.747863247863248, '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': '1970791', 'n_tokens_mistral': 844, 'n_tokens_neox': 809, 'n_words': 174}