Skip to content

Commit c6077e8

Browse files
committed
Merge branch 'dev' into 3.4
2 parents b84f16e + 239d8b0 commit c6077e8

22 files changed

+618
-765
lines changed

app/app.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ import LanguageProvider from 'containers/LanguageProvider';
2929

3030
// Load the favicon, the manifest.json file and the .htaccess file
3131
/* eslint-disable import/no-webpack-loader-syntax */
32-
import '!file?name=[name].[ext]!./favicon.ico';
33-
import '!file?name=[name].[ext]!./manifest.json';
34-
import 'file?name=[name].[ext]!./.htaccess'; // eslint-disable-line import/extensions
32+
import '!file-loader?name=[name].[ext]!./favicon.ico';
33+
import '!file-loader?name=[name].[ext]!./manifest.json';
34+
import 'file-loader?name=[name].[ext]!./.htaccess'; // eslint-disable-line import/extensions
3535
/* eslint-enable import/no-webpack-loader-syntax */
3636

3737
import configureStore from './store';
@@ -107,11 +107,11 @@ if (module.hot) {
107107
// Chunked polyfill for browsers without Intl support
108108
if (!window.Intl) {
109109
(new Promise((resolve) => {
110-
resolve(System.import('intl'));
110+
resolve(import('intl'));
111111
}))
112112
.then(() => Promise.all([
113-
System.import('intl/locale-data/jsonp/en.js'),
114-
System.import('intl/locale-data/jsonp/de.js'),
113+
import('intl/locale-data/jsonp/en.js'),
114+
import('intl/locale-data/jsonp/de.js'),
115115
]))
116116
.then(() => render(translationMessages))
117117
.catch((err) => {

app/containers/HomePage/sagas.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
* Gets the repositories of the user from Github
33
*/
44

5-
import { takeLatest } from 'redux-saga';
6-
import { take, call, put, select, fork, cancel } from 'redux-saga/effects';
5+
import { take, call, put, select, cancel, takeLatest } from 'redux-saga/effects';
76
import { LOCATION_CHANGE } from 'react-router-redux';
87
import { LOAD_REPOS } from 'containers/App/constants';
98
import { reposLoaded, repoLoadingError } from 'containers/App/actions';
@@ -28,20 +27,14 @@ export function* getRepos() {
2827
}
2928
}
3029

31-
/**
32-
* Watches for LOAD_REPOS actions and calls getRepos when one comes in.
33-
* By using `takeLatest` only the result of the latest API call is applied.
34-
*/
35-
export function* getReposWatcher() {
36-
yield fork(takeLatest, LOAD_REPOS, getRepos);
37-
}
38-
3930
/**
4031
* Root saga manages watcher lifecycle
4132
*/
4233
export function* githubData() {
43-
// Fork watcher so we can continue execution
44-
const watcher = yield fork(getReposWatcher);
34+
// Watches for LOAD_REPOS actions and calls getRepos when one comes in.
35+
// By using `takeLatest` only the result of the latest API call is applied.
36+
// It returns task descriptor (just like fork) so we can continue execution
37+
const watcher = yield takeLatest(LOAD_REPOS, getRepos);
4538

4639
// Suspend execution until location changes
4740
yield take(LOCATION_CHANGE);

app/containers/HomePage/tests/sagas.test.js

+15-19
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
* Tests for HomePage sagas
33
*/
44

5-
import { takeLatest } from 'redux-saga';
6-
import { take, put, fork } from 'redux-saga/effects';
5+
import { cancel, take, put, takeLatest } from 'redux-saga/effects';
6+
import { createMockTask } from 'redux-saga/lib/utils';
7+
78
import { LOCATION_CHANGE } from 'react-router-redux';
89

910
import { LOAD_REPOS } from 'containers/App/constants';
1011
import { reposLoaded, repoLoadingError } from 'containers/App/actions';
1112

12-
import { getRepos, getReposWatcher, githubData } from '../sagas';
13+
import { getRepos, githubData } from '../sagas';
1314

1415
const username = 'mxstbr';
1516

@@ -46,27 +47,22 @@ describe('getRepos Saga', () => {
4647
});
4748
});
4849

49-
describe('getReposWatcher Saga', () => {
50-
const getReposWatcherGenerator = getReposWatcher();
51-
52-
it('should watch for LOAD_REPOS action', () => {
53-
const takeDescriptor = getReposWatcherGenerator.next().value;
54-
expect(takeDescriptor).toEqual(fork(takeLatest, LOAD_REPOS, getRepos));
55-
});
56-
});
57-
5850
describe('githubDataSaga Saga', () => {
5951
const githubDataSaga = githubData();
52+
const mockedTask = createMockTask();
6053

61-
let forkDescriptor;
62-
63-
it('should asyncronously fork getReposWatcher saga', () => {
64-
forkDescriptor = githubDataSaga.next();
65-
expect(forkDescriptor.value).toEqual(fork(getReposWatcher));
54+
it('should start task to watch for LOAD_REPOS action', () => {
55+
const takeLatestDescriptor = githubDataSaga.next().value;
56+
expect(takeLatestDescriptor).toEqual(takeLatest(LOAD_REPOS, getRepos));
6657
});
6758

6859
it('should yield until LOCATION_CHANGE action', () => {
69-
const takeDescriptor = githubDataSaga.next();
70-
expect(takeDescriptor.value).toEqual(take(LOCATION_CHANGE));
60+
const takeDescriptor = githubDataSaga.next(mockedTask).value;
61+
expect(takeDescriptor).toEqual(take(LOCATION_CHANGE));
62+
});
63+
64+
it('should cancel the forked task when LOCATION_CHANGE happens', () => {
65+
const cancelDescriptor = githubDataSaga.next().value;
66+
expect(cancelDescriptor).toEqual(cancel(mockedTask));
7167
});
7268
});

app/routes.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export default function createRoutes(store) {
2222
name: 'home',
2323
getComponent(nextState, cb) {
2424
const importModules = Promise.all([
25-
System.import('containers/HomePage/reducer'),
26-
System.import('containers/HomePage/sagas'),
27-
System.import('containers/HomePage'),
25+
import('containers/HomePage/reducer'),
26+
import('containers/HomePage/sagas'),
27+
import('containers/HomePage'),
2828
]);
2929

3030
const renderRoute = loadModule(cb);
@@ -42,15 +42,15 @@ export default function createRoutes(store) {
4242
path: '/features',
4343
name: 'features',
4444
getComponent(nextState, cb) {
45-
System.import('containers/FeaturePage')
45+
import('containers/FeaturePage')
4646
.then(loadModule(cb))
4747
.catch(errorLoading);
4848
},
4949
}, {
5050
path: '*',
5151
name: 'notfound',
5252
getComponent(nextState, cb) {
53-
System.import('containers/NotFoundPage')
53+
import('containers/NotFoundPage')
5454
.then(loadModule(cb))
5555
.catch(errorLoading);
5656
},

app/store.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function configureStore(initialState = {}, history) {
4646
/* istanbul ignore next */
4747
if (module.hot) {
4848
module.hot.accept('./reducers', () => {
49-
System.import('./reducers').then((reducerModule) => {
49+
import('./reducers').then((reducerModule) => {
5050
const createReducers = reducerModule.default;
5151
const nextReducers = createReducers(store.asyncReducers);
5252

docs/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- [General](general)
66
- [**CLI Commands**](general/commands.md)
7+
- [Introduction ](general/introduction.md)
78
- [Tool Configuration](general/files.md)
89
- [Server Configurations](general/server-configs.md)
910
- [Deployment](general/deployment.md) *(currently Heroku specific)*

docs/general/faq.md

+12
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,18 @@ While it's possible to keep your project up-to-date or "in sync" with `react-boi
238238
very difficult and therefore ***at your own risk*** and not recommend. You should not need to do it either, as
239239
every version you use will be amazing! There is a long term goal to make this much easier but no ETA at the moment.
240240
241+
## How to turn off Webpack performance warnings after production build?
242+
243+
Webpack recommends having those performance hints turned off in development but to keep them on in production. If you still want to disable them, add the next lines to the config in `webpack.prod.babel.js`:
244+
245+
```js
246+
performance: {
247+
hints: false
248+
}
249+
```
250+
You can find more information about the `performance` option in the Webpack documentation: [Configuration/Performance](https://webpack.js.org/configuration/performance/).
251+
252+
241253
## Have another question?
242254
243255
Submit an [issue](https://github.com/mxstbr/react-boilerplate/issues),

0 commit comments

Comments
 (0)