Skip to content

Commit

Permalink
Remove async component loader - too much problems
Browse files Browse the repository at this point in the history
  • Loading branch information
jurkian committed Nov 15, 2019
1 parent 5fe03e1 commit e11a560
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 85 deletions.
8 changes: 0 additions & 8 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
"version": "1.0.0",
"private": true,
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-scripts": "3.2.0",
"axios": "^0.19.0",
"classnames": "^2.2.6",
"connected-react-router": "^6.5.2",
Expand All @@ -15,11 +12,13 @@
"jwt-decode": "^2.2.0",
"lodash": "^4.17.15",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-day-picker": "^7.4.0",
"react-loadable": "^5.5.0",
"react-dom": "^16.12.0",
"react-loading": "^2.0.3",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"recharts": "^1.8.5",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
Expand Down
34 changes: 7 additions & 27 deletions web/src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,21 @@ import * as actions from 'actions';
import { updateAPIConfig } from 'api/base';
import { isValidToken } from 'tools';

import AsyncComponentLoader from 'tools/AsyncComponentLoader';
import Layout from 'hoc/Layout';
import Modal from 'components/UI/Modal';
import NewsletterBox from 'components/NewsletterBox';

import Home from 'containers/Home';
import CurrencyStats from 'containers/CurrencyStats';
import Panel from 'containers/Panel';

import Login from 'containers/Auth/Login';
import Register from 'containers/Auth/Register';
import Logout from 'components/Auth/Logout';
import PageNotFound from 'components/PageNotFound';

import './app.scss';

const Home = AsyncComponentLoader({
loader: () => import('containers/Home')
});

const Login = AsyncComponentLoader({
loader: () => import('containers/Auth/Login')
});

const Register = AsyncComponentLoader({
loader: () => import('containers/Auth/Register')
});

const CurrencyStats = AsyncComponentLoader({
loader: () => import('containers/CurrencyStats')
});

const Panel = AsyncComponentLoader({
loader: () => import('containers/Panel')
});

class App extends Component {
componentDidMount() {
isValidToken()
Expand Down Expand Up @@ -86,9 +71,4 @@ const mapDispatchToProps = dispatch => {
};
};

export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps
)(App)
);
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(App));
5 changes: 1 addition & 4 deletions web/src/containers/Auth/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,4 @@ const mapDispatchToProps = dispatch => {
};
};

export default connect(
null,
mapDispatchToProps
)(withAuth(Login));
export default connect(null, mapDispatchToProps)(withAuth(Login));
40 changes: 8 additions & 32 deletions web/src/containers/Panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,18 @@ import withAuth from 'hoc/WithAuth';
import { isValidToken } from 'tools';

import Loader from 'components/UI/Loader';
import AsyncComponentLoader from 'tools/AsyncComponentLoader';

import Navigation from 'containers/Navigation';
import PanelIntro from 'containers/Panel/Intro';
import PageNotFound from 'components/PageNotFound';

const Accounts = AsyncComponentLoader({
loader: () => import('containers/Accounts')
});

const Transfers = AsyncComponentLoader({
loader: () => import('containers/Transfers')
});

const Cards = AsyncComponentLoader({
loader: () => import('containers/Cards')
});

const Profile = AsyncComponentLoader({
loader: () => import('containers/Profile')
});

const ProfileChangeDetails = AsyncComponentLoader({
loader: () => import('containers/Profile/ChangeDetails')
});

const Messages = AsyncComponentLoader({
loader: () => import('containers/Messages')
});

const Help = AsyncComponentLoader({
loader: () => import('components/Help')
});
import Accounts from 'containers/Accounts';
import Transfers from 'containers/Transfers';
import Cards from 'containers/Cards';
import Profile from 'containers/Profile';
import ProfileChangeDetails from 'containers/Profile/ChangeDetails';
import Messages from 'containers/Messages';
import Help from 'components/Help';

// Get all user's initial data or redirect back to /login if not logged in
// This is all handled in withAuth HOC
Expand Down Expand Up @@ -93,7 +72,4 @@ const mapDispatchToProps = dispatch => {
};
};

export default connect(
mapStateToProps,
mapDispatchToProps
)(withAuth(Panel));
export default connect(mapStateToProps, mapDispatchToProps)(withAuth(Panel));
10 changes: 0 additions & 10 deletions web/src/tools/AsyncComponentLoader/index.js

This file was deleted.

0 comments on commit e11a560

Please sign in to comment.