Skip to content

Commit

Permalink
feat(webpack): Support 'browser' property (react-boilerplate#1161)
Browse files Browse the repository at this point in the history
* 3.2.1

* Clean up code in script files (react-boilerplate#775)

* Revert "Clean up code in script files" (react-boilerplate#1114)

* feat(docs): Setting up index routes in routing docs (react-boilerplate#1099)

See react-boilerplate#1056 (comment)

* feat(example): Use takeLatest (react-boilerplate#1062)

* Use takeLatest

* Update comment

* Remove cancel

* Revert Remove cancel

* feat(docs): Update deployment.md (react-boilerplate#1120)

* Update deployment.md

Otherwise the `npm run build` will never run and `Not Found` be displayed when deployed.

* Update deployment.md

* feat(core): Add a key property to IntlProvider (react-boilerplate#1107)

This persuades React that the component has been modified and makes it rerender

* Support 'browser' property
  • Loading branch information
episage authored and mxstbr committed Nov 2, 2016
1 parent 9086050 commit 7042a25
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions app/containers/HomePage/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Gets the repositories of the user from Github
*/

import { takeLatest } from 'redux-saga';
import { take, call, put, select, fork, cancel } from 'redux-saga/effects';
import { LOCATION_CHANGE } from 'react-router-redux';
import { LOAD_REPOS } from 'containers/App/constants';
Expand Down Expand Up @@ -29,12 +30,11 @@ export function* getRepos() {
}

/**
* Watches for LOAD_REPOS action and calls handler
* Watches for LOAD_REPOS actions and calls getRepos when one comes in.
* By using `takeLatest` only the result of the latest API call is applied.
*/
export function* getReposWatcher() {
while (yield take(LOAD_REPOS)) {
yield call(getRepos);
}
yield fork(takeLatest, LOAD_REPOS, getRepos);
}

/**
Expand Down
18 changes: 7 additions & 11 deletions app/containers/HomePage/tests/sagas.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/

import expect from 'expect';
import { takeLatest } from 'redux-saga';
import { take, call, put, select, fork, cancel } from 'redux-saga/effects';
import { LOCATION_CHANGE } from 'react-router-redux';

Expand Down Expand Up @@ -58,12 +59,7 @@ describe('getReposWatcher Saga', () => {

it('should watch for LOAD_REPOS action', () => {
const takeDescriptor = getReposWatcherGenerator.next().value;
expect(takeDescriptor).toEqual(take(LOAD_REPOS));
});

it('should invoke getRepos saga on actions', () => {
const callDescriptor = getReposWatcherGenerator.next(put(LOAD_REPOS)).value;
expect(callDescriptor).toEqual(call(getRepos));
expect(takeDescriptor).toEqual(fork(takeLatest, LOAD_REPOS, getRepos));
});
});

Expand All @@ -83,10 +79,10 @@ describe('githubDataSaga Saga', () => {
});

it('should finally cancel() the forked getReposWatcher saga',
function* githubDataSagaCancellable() {
function* githubDataSagaCancellable() {
// reuse open fork for more integrated approach
forkDescriptor = githubDataSaga.next(put(LOCATION_CHANGE));
expect(forkDescriptor.value).toEqual(cancel(forkDescriptor));
}
);
forkDescriptor = githubDataSaga.next(put(LOCATION_CHANGE));
expect(forkDescriptor.value).toEqual(cancel(forkDescriptor));
}
);
});
2 changes: 1 addition & 1 deletion app/containers/LanguageProvider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { selectLocale } from './selectors';
export class LanguageProvider extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<IntlProvider locale={this.props.locale} messages={this.props.messages[this.props.locale]}>
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
{React.Children.only(this.props.children)}
</IntlProvider>
);
Expand Down
2 changes: 1 addition & 1 deletion docs/general/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

*Step 2:* Install heroku's buildpack on your heroku app by running the following command: `heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs#v90 -a [your app name]`. Make sure to replace `#v90` with whatever the latest buildpack is which you can [find here](https://github.com/heroku/heroku-buildpack-nodejs/releases).

*Step 3:* Add this line to your Package.json file in the scripts area: `"postinstall": "npm run build:clean",`. This is because Heroku runs this as part of their build process (more of which you can [read about here](https://devcenter.heroku.com/articles/nodejs-support#build-behavior)).
*Step 3:* Add this line to your Package.json file in the scripts area: `"postinstall": "npm run build:clean",`. This is because Heroku runs this as part of their build process (more of which you can [read about here](https://devcenter.heroku.com/articles/nodejs-support#build-behavior)). Then remove this line from your `package.json` file from the scripts area: `"prebuild": "npm run build:clean && npm run test",`, to avoid having Heroku try to run Karma in its dynamo.

*Step 4:* Have heroku build your static files when deploying. Add this line to your Package.json file in the scripts area: `"heroku-postbuild": "npm run build",`. ([read about heroku-postbuild here](https://devcenter.heroku.com/articles/nodejs-support#heroku-specific-build-steps)).

Expand Down
2 changes: 1 addition & 1 deletion internals/templates/languageProvider/languageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { selectLocale } from './selectors';
export class LanguageProvider extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
return (
<IntlProvider locale={this.props.locale} messages={this.props.messages[this.props.locale]}>
<IntlProvider locale={this.props.locale} key={this.props.locale} messages={this.props.messages[this.props.locale]}>
{React.Children.only(this.props.children)}
</IntlProvider>
);
Expand Down
1 change: 1 addition & 0 deletions internals/webpack/webpack.base.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ module.exports = (options) => ({
mainFields: [
'browser',
'jsnext:main',
'browser',
'main',
],
},
Expand Down

0 comments on commit 7042a25

Please sign in to comment.