Use loads directly

This commit is contained in:
Jori Lallo
2016-08-12 14:56:39 +02:00
parent a65cf1d429
commit b2d00f3384
4 changed files with 11 additions and 13 deletions

View File

@ -1,5 +1,5 @@
import React from 'react';
import _truncate from 'lodash/truncate';
import _ from 'lodash';
import styles from './Title.scss';
import classNames from 'classnames/bind';
@ -15,7 +15,7 @@ class Title extends React.Component {
render() {
let title;
if (this.props.truncate) {
title = _truncate(this.props.children, this.props.truncate);
title = _.truncate(this.props.children, this.props.truncate);
} else {
title = this.props.children;
}

View File

@ -1,6 +1,4 @@
import _isEqual from 'lodash/isEqual';
import _indexOf from 'lodash/indexOf';
import _without from 'lodash/without';
import _ from 'lodash';
import { observable, action, computed, runInAction, toJS, autorunAsync } from 'mobx';
import { client } from 'utils/ApiClient';
import { browserHistory } from 'react-router';
@ -35,7 +33,7 @@ class DocumentSceneStore {
}
node.children = node.children.map(childNode => {
return collapseNodes(childNode);
})
});
return node;
};
@ -83,7 +81,7 @@ class DocumentSceneStore {
@action updateNavigationTree = async (tree) => {
// Only update when tree changes
if (_isEqual(toJS(tree), toJS(this.document.collection.navigationTree))) {
if (_.isEqual(toJS(tree), toJS(this.document.collection.navigationTree))) {
return true;
}
@ -105,8 +103,8 @@ class DocumentSceneStore {
}
@action onNodeCollapse = (nodeId, collapsed) => {
if (_indexOf(this.collapsedNodes, nodeId) >= 0) {
this.collapsedNodes = _without(this.collapsedNodes, nodeId);
if (_.indexOf(this.collapsedNodes, nodeId) >= 0) {
this.collapsedNodes = _.without(this.collapsedNodes, nodeId);
} else {
this.collapsedNodes.push(nodeId);
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import { observer } from 'mobx-react';
import _debounce from 'lodash/debounce';
import _ from 'lodash';
import { Flex } from 'reflexbox';
import Layout from 'components/Layout';
@ -22,7 +22,7 @@ class Search extends React.Component {
}
render() {
const search = _debounce((searchTerm) => {
const search = _.debounce((searchTerm) => {
this.store.search(searchTerm);
}, 250);

View File

@ -2,7 +2,7 @@ import {
DataTypes,
sequelize,
} from '../sequelize';
import _isEqual from 'lodash/isEqual';
import _ from 'lodash';
import Document from './Document';
const allowedAtlasTypes = [['atlas', 'journal']];
@ -121,7 +121,7 @@ const Atlas = sequelize.define('atlas', {
});
const documentIds = documents.map(doc => doc.id);
if (!_isEqual(nodeIds.sort(), documentIds.sort())) {
if (!_.isEqual(nodeIds.sort(), documentIds.sort())) {
throw new Error('Invalid navigation tree');
}