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

View File

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

View File

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

View File

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