optimized bundle size and dependencies
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import _ from 'lodash';
|
||||
import _xor from 'lodash/xor';
|
||||
import _last from 'lodash/last';
|
||||
import { combineReducers } from 'redux';
|
||||
|
||||
import {
|
||||
@@ -14,11 +15,11 @@ const activeEditors = (state = [ActiveEditors.MARKDOWN, ActiveEditors.TEXT], act
|
||||
switch (action.type) {
|
||||
case TOGGLE_EDITORS: {
|
||||
// TODO: A rewrite would be nice
|
||||
const newState = _.xor(state, [action.toggledEditor]);
|
||||
const newState = _xor(state, [action.toggledEditor]);
|
||||
if (newState.length > 0) {
|
||||
return newState;
|
||||
} else {
|
||||
return _.xor([ActiveEditors.MARKDOWN, ActiveEditors.TEXT], [action.toggledEditor]);
|
||||
return _xor([ActiveEditors.MARKDOWN, ActiveEditors.TEXT], [action.toggledEditor]);
|
||||
}
|
||||
}
|
||||
default:
|
||||
@@ -56,7 +57,7 @@ const textDefaultState = {
|
||||
};
|
||||
|
||||
const text = (state = textDefaultState, action) => {
|
||||
const lastRevision = _.last(state.revisions);
|
||||
const lastRevision = _last(state.revisions);
|
||||
|
||||
switch (action.type) {
|
||||
case UPDATE_TEXT: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import _ from 'lodash';
|
||||
import _map from 'lodash/map';
|
||||
|
||||
import auth from './auth';
|
||||
import constants from '../constants';
|
||||
@@ -84,7 +84,7 @@ class ApiClient {
|
||||
// Helpers
|
||||
|
||||
constructQueryString = (data) => {
|
||||
return _.map(data, (v, k) => {
|
||||
return _map(data, (v, k) => {
|
||||
return `${encodeURIComponent(k)}=${encodeURIComponent(v)}`;
|
||||
}).join('&');
|
||||
};
|
||||
|
||||
@@ -6,8 +6,6 @@ import { createStore, applyMiddleware } from 'redux';
|
||||
import { routerMiddleware } from 'react-router-redux';
|
||||
import { persistStore, autoRehydrate } from 'redux-persist';
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
import * as storage from 'redux-storage';
|
||||
import createEngine from 'redux-storage-engine-localstorage';
|
||||
import createLogger from 'redux-logger';
|
||||
import History from 'utils/History';
|
||||
|
||||
@@ -18,19 +16,16 @@ import reducers from 'reducers';
|
||||
import 'utils/base-styles.scss';
|
||||
|
||||
import Home from 'scenes/Home';
|
||||
import App from 'scenes/App';
|
||||
// import App from 'scenes/App';
|
||||
import Dashboard from 'scenes/Dashboard';
|
||||
import SlackAuth from 'scenes/SlackAuth';
|
||||
|
||||
// Redux
|
||||
|
||||
const reducer = storage.reducer(reducers);
|
||||
const loggerMiddleware = createLogger();
|
||||
const routerMiddlewareWithHistory = routerMiddleware(History);
|
||||
|
||||
const createStoreWithMiddleware = (createStore);
|
||||
|
||||
const store = createStore(reducer, applyMiddleware(
|
||||
const store = createStore(reducers, applyMiddleware(
|
||||
thunkMiddleware,
|
||||
routerMiddlewareWithHistory,
|
||||
loggerMiddleware,
|
||||
|
||||
Reference in New Issue
Block a user